From 01e1a5bc1257af9e193d00fd4dce10fa3f1f3d75 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 15 Jan 2009 12:42:52 +0000 Subject: * include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO, EF_IA_64_ARCHVER_1): New macros. Minor reformatting. * bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo (BFD32_BACKENDS_CFILES): Add new file vmsutil.c (vmsutil.lo): Add dependency rule * bfd/Makefile.in: Regenerate * bfd/config.bfd (ia64*-*-*vms*): Add case. * bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case. * bfd/configure: Regenerate * bfd/vmsutil.[ch]: New files * bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of attr to bfd_vma. * bfd/elfxx-ia64.c (elfNN_vms_post_process_headers, elfNN_vms_section_processing, elfNN_vms_final_write_processing, elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr, elfNN_vms_object_p): New functions * bfd/targets.c (bfd_elf64_ia64_vms_vec): New target. * gas/configure.tgt(ia64-*-*vms*): New target. * gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern. * gas/tc.h (md_number_to_chars): Declare iff undefined. * gas/config/obj-elf.c (obj_elf_change_section): Change type of arg attr to bfd_vma. (obj_elf_parse_section_letters): Return a bfd_vma. Change type of variables attr, md_attr to bfd_vma. (obj_elf_section_word): Likewise. (obj_elf_section): Change type of variable attr to bfd_vma * gas/config/obj-elf.h (obj_elf_change_section): Change type of arg attr to bfd_vma * gas/config/tc-ia64.c (bfdver.h,time.h): Include. (ia64_elf_section_letter): Now returns a bfd_vma. Handle VMS specific attributes. (ia64_elf_section_flags): Arg attr now a bfd_vma. (ia64_init): Don't turn on dependency checking for VMS. (ia64_target_format): Check for VMS flag bit. (do_alias): Hande decc$ functions. (get_vms_time): New function. (ia64_vms_note): New function. * gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma. (ia64_elf_section_flags): Arg attr now a bfd_vma. (tc_init_after_args): Define for VMS. * gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma. (alpha_elf_section_flags): Change type of arg attr to bfd_vma. * gas/config/tc-alpha.h: Likewise. * gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma. (x86_64_section_word): Return a bfd_vma. * gas/config/tc-i386.h: Likewise. * gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg attr to bfd_vma. * gas/config/tc-ip2k.h: Likewise. * gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma. (mep_elf_section_flags): Change type of arg attr to bfd_vma. * gas/config/tc-mep.h: Likewise. * gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma. (ppc_section_word): Return a bfd_vma. (ppc_section_flags): Change type of arg attr to bfd_vma. * gas/config/tc-ppc.h: Likewise. * gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR, DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME): New file with new macros * gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new macros. --- gas/ChangeLog | 48 ++++++++++++++ gas/config/obj-elf.c | 21 +++--- gas/config/obj-elf.h | 4 +- gas/config/tc-alpha.c | 4 +- gas/config/tc-alpha.h | 4 +- gas/config/tc-frv.h | 1 + gas/config/tc-i386.c | 4 +- gas/config/tc-i386.h | 4 +- gas/config/tc-ia64.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++--- gas/config/tc-ia64.h | 12 ++-- gas/config/tc-ip2k.c | 4 +- gas/config/tc-ip2k.h | 2 +- gas/config/tc-mep.c | 4 +- gas/config/tc-mep.h | 4 +- gas/config/tc-ppc.c | 6 +- gas/config/tc-ppc.h | 6 +- gas/config/te-vms.h | 42 ++++++++++++ gas/configure.tgt | 1 + gas/dwarf2dbg.c | 30 +++++++-- gas/dwarf2dbg.h | 2 +- gas/tc.h | 2 + 21 files changed, 330 insertions(+), 50 deletions(-) create mode 100644 gas/config/te-vms.h (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 60b6905..df4a3d1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,51 @@ +2009-01-15 Douglas B Rupp + + * configure.tgt(ia64-*-*vms*): New target. + * dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern. + * tc.h (md_number_to_chars): Declare iff undefined. + * config/obj-elf.c (obj_elf_change_section): Change type of arg + attr to bfd_vma. + (obj_elf_parse_section_letters): Return a bfd_vma. Change type of + variables attr, md_attr to bfd_vma. + (obj_elf_section_word): Likewise. + (obj_elf_section): Change type of variable attr to bfd_vma + * config/obj-elf.h (obj_elf_change_section): Change type of arg + attr to bfd_vma. + * config/tc-ia64.c (bfdver.h,time.h): Include. + (ia64_elf_section_letter): Now returns a bfd_vma. + Handle VMS specific attributes. + (ia64_elf_section_flags): Arg attr now a bfd_vma. + (ia64_init): Don't turn on dependency checking for VMS. + (ia64_target_format): Check for VMS flag bit. + (do_alias): Hande decc$ functions. + (get_vms_time): New function. + (ia64_vms_note): New function. + * config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma. + (ia64_elf_section_flags): Arg attr now a bfd_vma. + (tc_init_after_args): Define for VMS. + * config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma. + (alpha_elf_section_flags): Change type of arg attr to bfd_vma. + * config/tc-alpha.h: Likewise. + * config/tc-i386.c (x86_64_section_letter): Return a bfd_vma. + (x86_64_section_word): Return a bfd_vma. + * config/tc-i386.h: Likewise. + * config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg + attr to bfd_vma. + * config/tc-ip2k.h: Likewise. + * config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma. + (mep_elf_section_flags): Change type of arg attr to bfd_vma. + * config/tc-mep.h: Likewise. + * config/tc-ppc.c (ppc_section_letter): Return a bfd_vma. + (ppc_section_word): Return a bfd_vma. + (ppc_section_flags): Change type of arg attr to bfd_vma. + * config/tc-ppc.h: Likewise. + * config/tc-frv.h: Provide a prototype for frv_md_number_to_chars. + * config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR, + DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME): + New file with new macros + * dwarf2dbg.c (get_filenum, out_file_list): Default and call new + macros. + 2009-01-15 Nick Clifton PR 9722 diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index cf31770..4c68779 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1,6 +1,6 @@ /* ELF object file format Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -524,7 +524,7 @@ get_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf) void obj_elf_change_section (const char *name, int type, - int attr, + bfd_vma attr, int entsize, const char *group_name, int linkonce, @@ -720,10 +720,10 @@ obj_elf_change_section (const char *name, #endif } -static int +static bfd_vma obj_elf_parse_section_letters (char *str, size_t len) { - int attr = 0; + bfd_vma attr = 0; while (len > 0) { @@ -766,8 +766,8 @@ obj_elf_parse_section_letters (char *str, size_t len) { char *bad_msg = _("unrecognized .section attribute: want a,w,x,M,S,G,T"); #ifdef md_elf_section_letter - int md_attr = md_elf_section_letter (*str, &bad_msg); - if (md_attr >= 0) + bfd_vma md_attr = md_elf_section_letter (*str, &bad_msg); + if (md_attr > 0) attr |= md_attr; else #endif @@ -810,7 +810,7 @@ obj_elf_section_type (char *str, size_t len, bfd_boolean warn) return 0; } -static int +static bfd_vma obj_elf_section_word (char *str, size_t len, int *type) { int ret; @@ -826,8 +826,8 @@ obj_elf_section_word (char *str, size_t len, int *type) #ifdef md_elf_section_word { - int md_attr = md_elf_section_word (str, len); - if (md_attr >= 0) + bfd_vma md_attr = md_elf_section_word (str, len); + if (md_attr > 0) return md_attr; } #endif @@ -888,7 +888,8 @@ void obj_elf_section (int push) { char *name, *group_name, *beg; - int type, attr, dummy; + int type, dummy; + bfd_vma attr; int entsize; int linkonce; subsegT new_subsection = -1; diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h index 18067f1..95db355 100644 --- a/gas/config/obj-elf.h +++ b/gas/config/obj-elf.h @@ -1,6 +1,6 @@ /* ELF object file format. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + 2002, 2003, 2004, 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -166,7 +166,7 @@ extern void obj_elf_common (int); extern void obj_elf_data (int); extern void obj_elf_text (int); extern void obj_elf_change_section - (const char *, int, int, int, const char *, int, int); + (const char *, int, bfd_vma, int, const char *, int, int); extern struct fix *obj_elf_vtable_inherit (int); extern struct fix *obj_elf_vtable_entry (int); diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index a5b35fc..cc3f74e 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -4780,7 +4780,7 @@ select_gp_value (void) #ifdef OBJ_ELF /* Map 's' to SHF_ALPHA_GPREL. */ -int +bfd_vma alpha_elf_section_letter (int letter, char **ptr_msg) { if (letter == 's') @@ -4793,7 +4793,7 @@ alpha_elf_section_letter (int letter, char **ptr_msg) /* Map SHF_ALPHA_GPREL to SEC_SMALL_DATA. */ flagword -alpha_elf_section_flags (flagword flags, int attr, int type ATTRIBUTE_UNUSED) +alpha_elf_section_flags (flagword flags, bfd_vma attr, int type ATTRIBUTE_UNUSED) { if (attr & SHF_ALPHA_GPREL) flags |= SEC_SMALL_DATA; diff --git a/gas/config/tc-alpha.h b/gas/config/tc-alpha.h index 3a5dcf8..eb104cc 100644 --- a/gas/config/tc-alpha.h +++ b/gas/config/tc-alpha.h @@ -121,9 +121,9 @@ extern void alpha_frob_file_before_adjust (void); #ifdef OBJ_ELF #define md_elf_section_letter alpha_elf_section_letter -extern int alpha_elf_section_letter (int, char **); +extern bfd_vma alpha_elf_section_letter (int, char **); #define md_elf_section_flags alpha_elf_section_flags -extern flagword alpha_elf_section_flags (flagword, int, int); +extern flagword alpha_elf_section_flags (flagword, bfd_vma, int); #endif /* Whether to add support for explicit !relocation_op!sequence_number. At the diff --git a/gas/config/tc-frv.h b/gas/config/tc-frv.h index 732dacd..7fd5476 100644 --- a/gas/config/tc-frv.h +++ b/gas/config/tc-frv.h @@ -46,6 +46,7 @@ extern void frv_tomcat_workaround (void); #define md_cleanup frv_tomcat_workaround #define md_number_to_chars frv_md_number_to_chars +extern void frv_md_number_to_chars (char *, valueT, int); extern long frv_relax_frag (fragS *, long); #define md_relax_frag(segment, fragP, stretch) frv_relax_frag(fragP, stretch) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index f731abb..b5f127f 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -10104,7 +10104,7 @@ tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) /* For ELF on x86-64, add support for SHF_X86_64_LARGE. */ -int +bfd_vma x86_64_section_letter (int letter, char **ptr_msg) { if (flag_code == CODE_64BIT) @@ -10119,7 +10119,7 @@ x86_64_section_letter (int letter, char **ptr_msg) return -1; } -int +bfd_vma x86_64_section_word (char *str, size_t len) { if (len == 5 && flag_code == CODE_64BIT && CONST_STRNEQ (str, "large")) diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 1670041a..db580d8 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -263,8 +263,8 @@ extern void i386_solaris_fix_up_eh_frame (segT); #endif /* Support for SHF_X86_64_LARGE */ -extern int x86_64_section_word (char *, size_t); -extern int x86_64_section_letter (int, char **); +extern bfd_vma x86_64_section_word (char *, size_t); +extern bfd_vma x86_64_section_letter (int, char **); #define md_elf_section_letter(LETTER, PTR_MSG) x86_64_section_letter (LETTER, PTR_MSG) #define md_elf_section_word(STR, LEN) x86_64_section_word (STR, LEN) diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index da56dd3..7c369d4 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -1,6 +1,6 @@ /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 - Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009 Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of GAS, the GNU Assembler. @@ -50,6 +50,8 @@ #include "opcode/ia64.h" #include "elf/ia64.h" +#include "bfdver.h" +#include #ifdef HAVE_LIMITS_H #include @@ -834,13 +836,19 @@ set_section (char *name) /* Map 's' to SHF_IA_64_SHORT. */ -int +bfd_vma ia64_elf_section_letter (int letter, char **ptr_msg) { if (letter == 's') return SHF_IA_64_SHORT; else if (letter == 'o') return SHF_LINK_ORDER; +#ifdef TE_VMS + else if (letter == 'O') + return SHF_IA_64_VMS_OVERLAID; + else if (letter == 'g') + return SHF_IA_64_VMS_GLOBAL; +#endif *ptr_msg = _("Bad .section directive: want a,o,s,w,x,M,S,G,T in string"); return -1; @@ -850,7 +858,7 @@ ia64_elf_section_letter (int letter, char **ptr_msg) flagword ia64_elf_section_flags (flagword flags, - int attr, + bfd_vma attr, int type ATTRIBUTE_UNUSED) { if (attr & SHF_IA_64_SHORT) @@ -7297,7 +7305,10 @@ void ia64_init (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { md.flags = MD_FLAGS_DEFAULT; +#ifndef TE_VMS + /* Don't turn on dependency checking for VMS, doesn't work. */ md.detect_dv = 1; +#endif /* FIXME: We should change it to unwind_check_error someday. */ md.unwind_check = unwind_check_warning; md.hint_b = hint_b_error; @@ -7333,8 +7344,13 @@ ia64_target_format (void) else { if (md.flags & EF_IA_64_ABI64) -#ifdef TE_AIX50 +#if defined (TE_AIX50) return "elf64-ia64-aix-little"; +#elif defined (TE_VMS) + { + md.flags |= EF_IA_64_ARCHVER_1; + return "elf64-ia64-vms"; + } #else return "elf64-ia64-little"; #endif @@ -11575,9 +11591,17 @@ do_alias (const char *alias, void *value) symbolS *sym = symbol_find (h->name); if (sym == NULL) - as_warn_where (h->file, h->line, - _("symbol `%s' aliased to `%s' is not used"), - h->name, alias); + { +#ifdef TE_VMS + /* Uses .alias extensively to alias CRTL functions to same with + decc$ prefix. Sometimes function gets optimized away and a + warning results, which should be suppressed. */ + if (strncmp (alias, "decc$", 5) != 0) +#endif + as_warn_where (h->file, h->line, + _("symbol `%s' aliased to `%s' is not used"), + h->name, alias); + } else S_SET_NAME (sym, (char *) alias); } @@ -11610,3 +11634,138 @@ ia64_frob_file (void) { hash_traverse (secalias_hash, do_secalias); } + +#ifdef TE_VMS +#define NT_VMS_MHD 1 +#define NT_VMS_LNM 2 + +/* Integrity VMS 8.x identifies it's ELF modules with a standard ELF + .note section. */ + +/* Manufacture a VMS-like time string. */ +static void +get_vms_time (char *Now) +{ + char *pnt; + time_t timeb; + + time (&timeb); + pnt = ctime (&timeb); + pnt[3] = 0; + pnt[7] = 0; + pnt[10] = 0; + pnt[16] = 0; + pnt[24] = 0; + sprintf (Now, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11); +} + +void +ia64_vms_note (void) +{ + char *p; + asection *seg = now_seg; + subsegT subseg = now_subseg; + Elf_Internal_Note i_note; + asection *secp = NULL; + char *basec, *bname; + char buf [256]; + symbolS *sym; + + /* Create the .note section. */ + + secp = subseg_new (".note", 0); + bfd_set_section_flags (stdoutput, + secp, + SEC_HAS_CONTENTS | SEC_READONLY); + + /* Module header note. */ + basec = xstrdup (out_file_name); + bname = basename (basec); + if ((p = strrchr (bname, '.'))) + *p = '\0'; + + i_note.namesz = 8; + i_note.descsz = 40 + strlen (bname); + i_note.type = NT_VMS_MHD; + + p = frag_more (sizeof (i_note.namesz)); + number_to_chars_littleendian (p, i_note.namesz, 8); + + p = frag_more (sizeof (i_note.descsz)); + number_to_chars_littleendian (p, i_note.descsz, 8); + + p = frag_more (sizeof (i_note.type)); + number_to_chars_littleendian (p, i_note.type, 8); + + p = frag_more (8); + strcpy (p, "IPF/VMS"); + + get_vms_time (buf); + p = frag_more (17); + strcpy (p, buf); + + p = frag_more (17); + strcpy (p, "24-FEB-2005 15:00"); + + p = frag_more (strlen (bname) + 1); + strcpy (p, bname); + + p = frag_more (5); + strcpy (p, "V1.0"); + + frag_align (3, 0, 0); + + /* Language processor name note. */ + sprintf (buf, "GNU assembler version %s (%s) using BFD version %s", + VERSION, TARGET_ALIAS, BFD_VERSION_STRING); + + i_note.namesz = 8; + i_note.descsz = 1 + strlen (buf); + i_note.type = NT_VMS_LNM; + + p = frag_more (sizeof (i_note.namesz)); + number_to_chars_littleendian (p, i_note.namesz, 8); + + p = frag_more (sizeof (i_note.descsz)); + number_to_chars_littleendian (p, i_note.descsz, 8); + + p = frag_more (sizeof (i_note.type)); + number_to_chars_littleendian (p, i_note.type, 8); + + p = frag_more (8); + strcpy (p, "IPF/VMS"); + + p = frag_more (strlen (buf) + 1); + strcpy (p, buf); + + frag_align (3, 0, 0); + + secp = subseg_new (".vms_display_name_info", 0); + bfd_set_section_flags (stdoutput, + secp, + SEC_HAS_CONTENTS | SEC_READONLY); + + /* This symbol should be passed on the command line and be variable + according to language. */ + sym = symbol_new ("__gnat_vms_display_name@gnat_demangler_rtl", + absolute_section, 0, &zero_address_frag); + symbol_table_insert (sym); + symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING | BSF_DYNAMIC; + + p = frag_more (4); + /* Format 3 of VMS demangler Spec. */ + number_to_chars_littleendian (p, 3, 4); + + p = frag_more (4); + /* Place holder for symbol table index of above symbol. */ + number_to_chars_littleendian (p, -1, 4); + + frag_align (3, 0, 0); + + /* We probably can't restore the current segment, for there likely + isn't one yet... */ + if (seg && subseg) + subseg_set (seg, subseg); +} + +#endif /* TE_VMS */ diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h index a5e15d9..49a3d99 100644 --- a/gas/config/tc-ia64.h +++ b/gas/config/tc-ia64.h @@ -1,6 +1,6 @@ /* tc-ia64.h -- Header file for tc-ia64.c. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 - Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, + 2009 Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of GAS, the GNU Assembler. @@ -107,8 +107,8 @@ extern int ia64_force_relocation (struct fix *); extern void ia64_cons_fix_new (fragS *, int, int, expressionS *); extern void ia64_validate_fix (struct fix *); extern char * ia64_canonicalize_symbol_name (char *); -extern int ia64_elf_section_letter (int, char **); -extern flagword ia64_elf_section_flags (flagword, int, int); +extern bfd_vma ia64_elf_section_letter (int, char **); +extern flagword ia64_elf_section_flags (flagword, bfd_vma, int); extern int ia64_elf_section_type (const char *, size_t); extern long ia64_pcrel_from_section (struct fix *, segT); extern void ia64_md_do_align (int, const char *, int, int); @@ -156,6 +156,10 @@ extern void ia64_convert_frag (fragS *); #define md_after_parse_args() ia64_after_parse_args () #define TC_DWARF2_EMIT_OFFSET ia64_dwarf2_emit_offset #define tc_check_label(l) ia64_check_label (l) +#ifdef TE_VMS +#define tc_init_after_args() ia64_vms_note () +void ia64_vms_note (void); +#endif /* Record if an alignment frag should end with a stop bit. */ #define TC_FRAG_TYPE int diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c index 440a82d..bae23c4 100644 --- a/gas/config/tc-ip2k.c +++ b/gas/config/tc-ip2k.c @@ -411,8 +411,8 @@ ip2k_apply_fix (fixS *fixP, valueT *valueP, segT seg) } int -ip2k_elf_section_flags (int flags, - int attr ATTRIBUTE_UNUSED, +ip2k_elf_section_flags (flagword flags, + bfd_vma attr ATTRIBUTE_UNUSED, int type ATTRIBUTE_UNUSED) { /* This is used to detect when the section changes to an executable section. diff --git a/gas/config/tc-ip2k.h b/gas/config/tc-ip2k.h index 63a126d..4d62744 100644 --- a/gas/config/tc-ip2k.h +++ b/gas/config/tc-ip2k.h @@ -59,7 +59,7 @@ extern int ip2k_force_relocation (struct fix *); #define tc_gen_reloc gas_cgen_tc_gen_reloc #define md_elf_section_flags ip2k_elf_section_flags -extern int ip2k_elf_section_flags (int, int, int); +extern int ip2k_elf_section_flags (flagword, bfd_vma, int); #define md_operand(x) gas_cgen_md_operand (x) extern void gas_cgen_md_operand (expressionS *); diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index 2608019..5646b3f 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -1716,7 +1716,7 @@ mep_fix_adjustable (fixS *fixP) return 1; } -int +bfd_vma mep_elf_section_letter (int letter, char **ptrmsg) { if (letter == 'v') @@ -1727,7 +1727,7 @@ mep_elf_section_letter (int letter, char **ptrmsg) } flagword -mep_elf_section_flags (flagword flags, int attr, int type ATTRIBUTE_UNUSED) +mep_elf_section_flags (flagword flags, bfd_vma attr, int type ATTRIBUTE_UNUSED) { if (attr & SHF_MEP_VLIW) flags |= SEC_MEP_VLIW; diff --git a/gas/config/tc-mep.h b/gas/config/tc-mep.h index 510cf7a..de68d71 100644 --- a/gas/config/tc-mep.h +++ b/gas/config/tc-mep.h @@ -103,9 +103,9 @@ extern int mep_unrecognized_line (int); extern void mep_cleanup (void); #define md_elf_section_letter mep_elf_section_letter -extern int mep_elf_section_letter (int, char **); +extern bfd_vma mep_elf_section_letter (int, char **); #define md_elf_section_flags mep_elf_section_flags -extern flagword mep_elf_section_flags (flagword, int, int); +extern flagword mep_elf_section_flags (flagword, bfd_vma, int); #define ELF_TC_SPECIAL_SECTIONS \ { VTEXT_SECTION_NAME, SHT_PROGBITS, SHF_ALLOC|SHF_EXECINSTR|SHF_MEP_VLIW }, diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 66a2115..034eb8f 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2952,7 +2952,7 @@ ppc_macro (char *str, const struct powerpc_macro *macro) #ifdef OBJ_ELF /* For ELF, add support for SHF_EXCLUDE and SHT_ORDERED. */ -int +bfd_vma ppc_section_letter (int letter, char **ptr_msg) { if (letter == 'e') @@ -2962,7 +2962,7 @@ ppc_section_letter (int letter, char **ptr_msg) return -1; } -int +bfd_vma ppc_section_word (char *str, size_t len) { if (len == 7 && strncmp (str, "exclude", 7) == 0) @@ -2981,7 +2981,7 @@ ppc_section_type (char *str, size_t len) } int -ppc_section_flags (int flags, int attr, int type) +ppc_section_flags (flagword flags, bfd_vma attr, int type) { if (type == SHT_ORDERED) flags |= SEC_ALLOC | SEC_LOAD | SEC_SORT_ENTRIES; diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index 2702988..f1c02fd 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -207,10 +207,10 @@ extern const char ppc_symbol_chars[]; #ifdef OBJ_ELF /* Support for SHF_EXCLUDE and SHT_ORDERED */ -extern int ppc_section_letter (int, char **); +extern bfd_vma ppc_section_letter (int, char **); extern int ppc_section_type (char *, size_t); -extern int ppc_section_word (char *, size_t); -extern int ppc_section_flags (int, int, int); +extern bfd_vma ppc_section_word (char *, size_t); +extern int ppc_section_flags (flagword, bfd_vma, int); #define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG) #define md_elf_section_type(STR, LEN) ppc_section_type (STR, LEN) diff --git a/gas/config/te-vms.h b/gas/config/te-vms.h new file mode 100644 index 0000000..7c352ac --- /dev/null +++ b/gas/config/te-vms.h @@ -0,0 +1,42 @@ +#define TE_VMS +#include "obj-format.h" + +extern int vms_file_stats_name (const char *, long long *, long *, char *, int *); + +/* VMS debugger expects a separator. */ +#define DWARF2_DIR_SHOULD_END_WITH_SEPARATOR 1 + +/* VMS debugger needs the file timestamp. */ +#define DWARF2_FILE_TIME_NAME(FILENAME,DIRNAME) \ + ({ \ + long long cdt; \ + char *filename = (char *) alloca (strlen (FILENAME) + strlen (DIRNAME) + 1);\ + strcpy (filename, DIRNAME); \ + strcat (filename, FILENAME); \ + ((vms_file_stats_name (filename, &cdt, 0, 0, 0) == 0) ? cdt : 0); \ + }) + +/* VMS debugger needs the file size. */ +#define DWARF2_FILE_SIZE_NAME(FILENAME,DIRNAME) \ + ({ \ + long siz; \ + char *filename = (char *) alloca (strlen (FILENAME) + strlen (DIRNAME) + 1);\ + strcpy (filename, DIRNAME); \ + strcat (filename, FILENAME); \ + ((vms_file_stats_name (filename, 0, &siz, 0, 0) == 0) ? siz : 0); \ + }) + +/* VMS debugger needs the filename with version appended. */ +/* Longest filename on VMS is 255 characters. Largest version is 32768. */ +#define DWARF2_FILE_NAME(FILENAME,DIRNAME) \ + ({ \ + int ver; \ + char buff [255 + 7]; \ + char *filename = (char *) alloca (strlen (FILENAME) + strlen (DIRNAME) + 1);\ + strcpy (filename, DIRNAME); \ + strcat (filename, FILENAME); \ + vms_file_stats_name (filename, 0, 0, 0, &ver); \ + snprintf (buff, 255 + 7, "%s;%d", FILENAME, ver); \ + buff; \ + }) + diff --git a/gas/configure.tgt b/gas/configure.tgt index 0272b4e..f3def28 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -236,6 +236,7 @@ case ${generic_target} in i960-*-elf*) fmt=elf ;; ia64-*-elf*) fmt=elf ;; + ia64-*-*vms*) fmt=elf em=vms ;; ia64-*-aix*) fmt=elf em=ia64aix ;; ia64-*-linux-*) fmt=elf em=linux ;; ia64-*-hpux*) fmt=elf em=hpux ;; diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index b7857f2..2bcba9b 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -76,6 +76,18 @@ # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8) #endif +#ifndef DWARF2_FILE_NAME +#define DWARF2_FILE_NAME(FILENAME, DIRNAME) FILENAME +#endif + +#ifndef DWARF2_FILE_TIME_NAME +#define DWARF2_FILE_TIME_NAME(FILENAME,DIRNAME) 0 +#endif + +#ifndef DWARF2_FILE_SIZE_NAME +#define DWARF2_FILE_SIZE_NAME(FILENAME,DIRNAME) 0 +#endif + #include "subsegs.h" #include "elf/dwarf2.h" @@ -434,7 +446,9 @@ get_filenum (const char *filename, unsigned int num) dir = 0; if (dir_len) { +#ifndef DWARF2_DIR_SHOULD_END_WITH_SEPARATOR --dir_len; +#endif for (dir = 1; dir < dirs_in_use; ++dir) if (strncmp (filename, dirs[dir], dir_len) == 0 && dirs[dir][dir_len] == '\0') @@ -1281,6 +1295,8 @@ out_file_list (void) for (i = 1; i < files_in_use; ++i) { + const char *fullfilename; + if (files[i].filename == NULL) { as_bad (_("unassigned file number %ld"), (long) i); @@ -1289,13 +1305,19 @@ out_file_list (void) continue; } - size = strlen (files[i].filename) + 1; + fullfilename = DWARF2_FILE_NAME (files[i].filename, + files[i].dir ? dirs [files [i].dir] : ""); + size = strlen (fullfilename) + 1; cp = frag_more (size); - memcpy (cp, files[i].filename, size); + memcpy (cp, fullfilename, size); out_uleb128 (files[i].dir); /* directory number */ - out_uleb128 (0); /* last modification timestamp */ - out_uleb128 (0); /* filesize */ + /* Output the last modification timestamp. */ + out_uleb128 (DWARF2_FILE_TIME_NAME (files[i].filename, + files[i].dir ? dirs [files [i].dir] : "")); + /* Output the filesize. */ + out_uleb128 (DWARF2_FILE_SIZE_NAME (files[i].filename, + files[i].dir ? dirs [files [i].dir] : "")); } /* Terminate filename list. */ diff --git a/gas/dwarf2dbg.h b/gas/dwarf2dbg.h index 4dfc624..ee943ce 100644 --- a/gas/dwarf2dbg.h +++ b/gas/dwarf2dbg.h @@ -86,7 +86,7 @@ bfd_boolean dwarf2_loc_directive_seen; /* True when we're supposed to set the basic block mark whenever a label is seen. Unless the target is doing Something Weird, just call dwarf2_emit_label. */ -bfd_boolean dwarf2_loc_mark_labels; +extern bfd_boolean dwarf2_loc_mark_labels; extern void dwarf2_finish (void); diff --git a/gas/tc.h b/gas/tc.h index 5386513..8715db3 100644 --- a/gas/tc.h +++ b/gas/tc.h @@ -31,7 +31,9 @@ int md_parse_option (int, char *); void md_show_usage (FILE *); void md_assemble (char *); void md_begin (void); +#ifndef md_number_to_chars void md_number_to_chars (char *, valueT, int); +#endif void md_apply_fix (fixS *, valueT *, segT); #ifndef WORKING_DOT_WORD -- cgit v1.1