diff options
author | Nick Clifton <nickc@redhat.com> | 2009-01-15 12:42:52 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-01-15 12:42:52 +0000 |
commit | 01e1a5bc1257af9e193d00fd4dce10fa3f1f3d75 (patch) | |
tree | b610f2fb9a65f5349579a727e8e8ffa5e8af7e6f /gas/config/tc-ia64.c | |
parent | bc2d180888f7f4efabce7eccf95088a540bc4fcb (diff) | |
download | gdb-01e1a5bc1257af9e193d00fd4dce10fa3f1f3d75.zip gdb-01e1a5bc1257af9e193d00fd4dce10fa3f1f3d75.tar.gz gdb-01e1a5bc1257af9e193d00fd4dce10fa3f1f3d75.tar.bz2 |
* 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.
Diffstat (limited to 'gas/config/tc-ia64.c')
-rw-r--r-- | gas/config/tc-ia64.c | 175 |
1 files changed, 167 insertions, 8 deletions
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 <davidm@hpl.hp.com> 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 <time.h> #ifdef HAVE_LIMITS_H #include <limits.h> @@ -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 */ |