summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/Makefile.am3
-rw-r--r--bfd/config.bfd4
-rw-r--r--bfd/configure.in1
-rw-r--r--bfd/elf-bfd.h5
-rw-r--r--bfd/elf.c17
-rw-r--r--bfd/elfxx-ia64.c306
-rw-r--r--bfd/targets.c2
-rw-r--r--bfd/vmsutil.c267
-rw-r--r--bfd/vmsutil.h20
-rw-r--r--gas/ChangeLog48
-rw-r--r--gas/config/obj-elf.c21
-rw-r--r--gas/config/obj-elf.h4
-rw-r--r--gas/config/tc-alpha.c4
-rw-r--r--gas/config/tc-alpha.h4
-rw-r--r--gas/config/tc-frv.h1
-rw-r--r--gas/config/tc-i386.c4
-rw-r--r--gas/config/tc-i386.h4
-rw-r--r--gas/config/tc-ia64.c175
-rw-r--r--gas/config/tc-ia64.h12
-rw-r--r--gas/config/tc-ip2k.c4
-rw-r--r--gas/config/tc-ip2k.h2
-rw-r--r--gas/config/tc-mep.c4
-rw-r--r--gas/config/tc-mep.h4
-rw-r--r--gas/config/tc-ppc.c6
-rw-r--r--gas/config/tc-ppc.h6
-rw-r--r--gas/config/te-vms.h42
-rw-r--r--gas/configure.tgt1
-rw-r--r--gas/dwarf2dbg.c30
-rw-r--r--gas/dwarf2dbg.h2
-rw-r--r--gas/tc.h2
-rw-r--r--include/elf/ChangeLog5
-rw-r--r--include/elf/ia64.h23
33 files changed, 981 insertions, 71 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bc2df92985..052689fba1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,22 @@
+2009-01-15 Douglas B Rupp <rupp@gnat.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
+ (BFD32_BACKENDS_CFILES): Add new file vmsutil.c
+ (vmsutil.lo): Add dependency rule.
+ * Makefile.in: Regenerate.
+ * config.bfd (ia64*-*-*vms*): Add case.
+ * configure.in (bfd_elf64_ia64_vms_vec): Add case.
+ * configure: Regenerate.
+ * vmsutil.c: New file.
+ * vmsutil.h: New file.
+ * elf-bfd.h (struct bfd_elf_special_section): Change type of
+ attr to bfd_vma.
+ * 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
+ * targets.c (bfd_elf64_ia64_vms_vec): New target.
+
2009-01-14 H.J. Lu <hongjiu.lu@intel.com>
PR ld/9727
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 4eac4a052d..4e04def311 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -371,6 +371,7 @@ BFD32_BACKENDS = \
vms-hdr.lo \
vms-misc.lo \
vms-tir.lo \
+ vmsutil.lo \
xcofflink.lo \
xsym.lo \
xtensa-isa.lo \
@@ -552,6 +553,7 @@ BFD32_BACKENDS_CFILES = \
vms-hdr.c \
vms-misc.c \
vms-tir.c \
+ vmsutil.c \
xcofflink.c \
xsym.c \
xtensa-isa.c \
@@ -1833,6 +1835,7 @@ vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h vms.h
+vmsutil.lo: vmsutil.c vmsutil.h $(INCDIR)/ansidecl.h
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
libcoff.h libxcoff.h
diff --git a/bfd/config.bfd b/bfd/config.bfd
index e3d2b8602c..d9865e6178 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -187,6 +187,10 @@ case "${targ}" in
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
want64=true
;;
+ ia64*-*-*vms*)
+ targ_defvec=bfd_elf64_ia64_vms_vec
+ want64=true
+ ;;
sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_sparc_freebsd_vec
targ_selvecs="bfd_elf64_sparc_vec bfd_elf32_sparc_vec sunos_big_vec"
diff --git a/bfd/configure.in b/bfd/configure.in
index d75e15aae6..663eba4449 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -771,6 +771,7 @@ do
bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_vms_vec) tb="$tb elf64-ia64.lo elf64.lo $elf vmsutil.lo"; target_size=64 ;;
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5418e7f82e..1ad82dedfb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1,6 +1,7 @@
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -594,7 +595,7 @@ struct bfd_elf_special_section
PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
int suffix_length;
int type;
- int attr;
+ bfd_vma attr;
};
enum action_discarded
diff --git a/bfd/elf.c b/bfd/elf.c
index 70ed7656d0..0009ee87f9 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2778,14 +2778,17 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
asection *s;
unsigned int idx;
- loc -= 4;
s = elt;
- if (!gas)
- s = s->output_section;
- idx = 0;
- if (s != NULL)
- idx = elf_section_data (s)->this_idx;
- H_PUT_32 (abfd, idx, loc);
+ if (! elf_discarded_section (s))
+ {
+ loc -= 4;
+ if (!gas)
+ s = s->output_section;
+ idx = 0;
+ if (s != NULL)
+ idx = elf_section_data (s)->this_idx;
+ H_PUT_32 (abfd, idx, loc);
+ }
elt = elf_next_in_group (elt);
if (elt == first)
break;
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 801c25b8f0..b6f103a7e7 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -1,6 +1,6 @@
/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2009 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -5618,6 +5618,267 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
}
}
+static bfd_boolean
+elfNN_vms_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name,
+ int shindex)
+{
+ asection *newsect;
+
+ switch (hdr->sh_type)
+ {
+ case SHT_IA_64_VMS_TRACE:
+ case SHT_IA_64_VMS_DEBUG:
+ case SHT_IA_64_VMS_DEBUG_STR:
+ break;
+
+ default:
+ return elfNN_ia64_section_from_shdr (abfd, hdr, name, shindex);
+ }
+
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return FALSE;
+ newsect = hdr->bfd_section;
+
+ return TRUE;
+}
+
+static bfd_boolean
+elfNN_vms_object_p (bfd *abfd)
+{
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+ Elf_Internal_Phdr *i_phdr = elf_tdata (abfd)->phdr;
+ unsigned int i;
+ unsigned int num_text = 0;
+ unsigned int num_data = 0;
+ unsigned int num_rodata = 0;
+ char name[16];
+
+ if (!elfNN_ia64_object_p (abfd))
+ return FALSE;
+
+ for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++)
+ {
+ /* Is there a section for this segment? */
+ bfd_vma base_vma = i_phdr->p_vaddr;
+ bfd_vma limit_vma = base_vma + i_phdr->p_filesz;
+
+ if (i_phdr->p_type != PT_LOAD)
+ continue;
+
+ again:
+ while (base_vma < limit_vma)
+ {
+ bfd_vma next_vma = limit_vma;
+ asection *nsec;
+ asection *sec;
+ flagword flags;
+ char *nname = NULL;
+
+ /* Find a section covering base_vma. */
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ if ((sec->flags & (SEC_ALLOC | SEC_LOAD)) == 0)
+ continue;
+ if (sec->vma <= base_vma && sec->vma + sec->size > base_vma)
+ {
+ base_vma = sec->vma + sec->size;
+ goto again;
+ }
+ if (sec->vma < next_vma && sec->vma + sec->size >= base_vma)
+ next_vma = sec->vma;
+ }
+
+ /* No section covering [base_vma; next_vma). Create a fake one. */
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ if (i_phdr->p_flags & PF_X)
+ {
+ flags |= SEC_CODE;
+ if (num_text++ == 0)
+ nname = ".text";
+ else
+ sprintf (name, ".text$%u", num_text);
+ }
+ else if ((i_phdr->p_flags & (PF_R | PF_W)) == PF_R)
+ {
+ flags |= SEC_READONLY;
+ sprintf (name, ".rodata$%u", num_rodata++);
+ }
+ else
+ {
+ flags |= SEC_DATA;
+ sprintf (name, ".data$%u", num_data++);
+ }
+
+ /* Allocate name. */
+ if (nname == NULL)
+ {
+ size_t name_len = strlen (name) + 1;
+ nname = bfd_alloc (abfd, name_len);
+ if (nname == NULL)
+ return FALSE;
+ memcpy (nname, name, name_len);
+ }
+
+ /* Create and fill new section. */
+ nsec = bfd_make_section_anyway_with_flags (abfd, nname, flags);
+ if (nsec == NULL)
+ return FALSE;
+ nsec->vma = base_vma;
+ nsec->size = next_vma - base_vma;
+ nsec->filepos = i_phdr->p_offset + (base_vma - i_phdr->p_vaddr);
+
+ base_vma = next_vma;
+ }
+ }
+ return TRUE;
+}
+
+static void
+elfNN_vms_post_process_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_OPENVMS;
+ i_ehdrp->e_ident[EI_ABIVERSION] = 2;
+}
+
+static bfd_boolean
+elfNN_vms_section_processing (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *hdr)
+{
+ if (hdr->bfd_section != NULL)
+ {
+ const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
+
+ if (strcmp (name, ".text") == 0)
+ hdr->sh_flags |= SHF_IA_64_VMS_SHARED;
+ else if ((strcmp (name, ".debug") == 0)
+ || (strcmp (name, ".debug_abbrev") == 0)
+ || (strcmp (name, ".debug_aranges") == 0)
+ || (strcmp (name, ".debug_frame") == 0)
+ || (strcmp (name, ".debug_info") == 0)
+ || (strcmp (name, ".debug_loc") == 0)
+ || (strcmp (name, ".debug_macinfo") == 0)
+ || (strcmp (name, ".debug_pubnames") == 0)
+ || (strcmp (name, ".debug_pubtypes") == 0))
+ hdr->sh_type = SHT_IA_64_VMS_DEBUG;
+ else if ((strcmp (name, ".debug_line") == 0)
+ || (strcmp (name, ".debug_ranges") == 0))
+ hdr->sh_type = SHT_IA_64_VMS_TRACE;
+ else if (strcmp (name, ".debug_str") == 0)
+ hdr->sh_type = SHT_IA_64_VMS_DEBUG_STR;
+ else if (strcmp (name, ".vms_display_name_info") == 0)
+ {
+ int idx, symcount;
+ asymbol **syms;
+ struct elf_obj_tdata *t = elf_tdata (abfd);
+ int buf[2];
+ int demangler_sym_idx = -1;
+
+ symcount = bfd_get_symcount (abfd);
+ syms = bfd_get_outsymbols (abfd);
+ for (idx = 0; idx < symcount; idx++)
+ {
+ asymbol *sym;
+ sym = syms[idx];
+ if ((sym->flags & (BSF_DEBUGGING | BSF_DYNAMIC))
+ && strchr (sym->name, '@')
+ && (strcmp (sym->section->name, BFD_ABS_SECTION_NAME) == 0))
+ {
+ demangler_sym_idx = sym->udata.i;
+ break;
+ }
+ }
+
+ hdr->sh_type = SHT_IA_64_VMS_DISPLAY_NAME_INFO;
+ hdr->sh_entsize = 4;
+ hdr->sh_addralign = 0;
+ hdr->sh_link = t->symtab_section;
+
+ /* Find symtab index of demangler routine and stuff it in
+ the second long word of section data. */
+
+ if (demangler_sym_idx > -1)
+ {
+ bfd_seek (abfd, hdr->sh_offset, SEEK_SET);
+ bfd_bread (buf, hdr->sh_size, abfd);
+ buf [1] = demangler_sym_idx;
+ bfd_seek (abfd, hdr->sh_offset, SEEK_SET);
+ bfd_bwrite (buf, hdr->sh_size, abfd);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* The final processing done just before writing out a VMS IA-64 ELF
+ object file. */
+
+static void
+elfNN_vms_final_write_processing (bfd *abfd,
+ bfd_boolean linker ATTRIBUTE_UNUSED)
+{
+ Elf_Internal_Shdr *hdr;
+ asection *s;
+ int unwind_info_sect_idx = 0;
+
+ for (s = abfd->sections; s; s = s->next)
+ {
+ hdr = &elf_section_data (s)->this_hdr;
+
+ if (strcmp (bfd_get_section_name (abfd, hdr->bfd_section),
+ ".IA_64.unwind_info") == 0)
+ unwind_info_sect_idx = elf_section_data (s)->this_idx;
+
+ switch (hdr->sh_type)
+ {
+ case SHT_IA_64_UNWIND:
+ /* VMS requires sh_info to point to the unwind info section. */
+ hdr->sh_info = unwind_info_sect_idx;
+ break;
+ }
+ }
+
+ if (! elf_flags_init (abfd))
+ {
+ unsigned long flags = 0;
+
+ if (abfd->xvec->byteorder == BFD_ENDIAN_BIG)
+ flags |= EF_IA_64_BE;
+ if (bfd_get_mach (abfd) == bfd_mach_ia64_elf64)
+ flags |= EF_IA_64_ABI64;
+
+ elf_elfheader(abfd)->e_flags = flags;
+ elf_flags_init (abfd) = TRUE;
+ }
+}
+
+static bfd_boolean
+elfNN_vms_close_and_cleanup (bfd *abfd)
+{
+ if (bfd_get_format (abfd) == bfd_object)
+ {
+ long isize, irsize;
+
+ if (elf_shstrtab (abfd) != NULL)
+ _bfd_elf_strtab_free (elf_shstrtab (abfd));
+
+ /* Pad to 8 byte boundary for IPF/VMS. */
+ isize = bfd_get_size (abfd);
+ if ((irsize = isize/8*8) < isize)
+ {
+ int ishort = (irsize + 8) - isize;
+ bfd_seek (abfd, isize, SEEK_SET);
+ bfd_bwrite (bfd_zmalloc (ishort), ishort, abfd);
+ }
+ }
+
+ return _bfd_generic_close_and_cleanup (abfd);
+}
#define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec
#define TARGET_LITTLE_NAME "elfNN-ia64-little"
@@ -5750,4 +6011,45 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
#include "elfNN-target.h"
+/* VMS-specific vectors. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elfNN_ia64_vms_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elfNN-ia64-vms"
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+/* These are VMS specific functions. */
+
+#undef elf_backend_object_p
+#define elf_backend_object_p elfNN_vms_object_p
+
+#undef elf_backend_section_from_shdr
+#define elf_backend_section_from_shdr elfNN_vms_section_from_shdr
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers elfNN_vms_post_process_headers
+
+#undef elf_backend_section_processing
+#define elf_backend_section_processing elfNN_vms_section_processing
+
+#undef elf_backend_final_write_processing
+#define elf_backend_final_write_processing elfNN_vms_final_write_processing
+
+#undef bfd_elfNN_close_and_cleanup
+#define bfd_elfNN_close_and_cleanup elfNN_vms_close_and_cleanup
+
+#undef elf_backend_section_from_bfd_section
+
+#undef elf_backend_symbol_processing
+
#undef elf_backend_want_p_paddr_set_to_zero
+
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x10000 /* 64KB */
+
+#undef elfNN_bed
+#define elfNN_bed elfNN_ia64_vms_bed
+
+#include "elfNN-target.h"
diff --git a/bfd/targets.c b/bfd/targets.c
index e64b463b74..2eab66383c 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -680,6 +680,7 @@ extern const bfd_target bfd_elf64_hppa_vec;
extern const bfd_target bfd_elf64_ia64_big_vec;
extern const bfd_target bfd_elf64_ia64_hpux_big_vec;
extern const bfd_target bfd_elf64_ia64_little_vec;
+extern const bfd_target bfd_elf64_ia64_vms_vec;
extern const bfd_target bfd_elf64_little_generic_vec;
extern const bfd_target bfd_elf64_littlemips_vec;
extern const bfd_target bfd_elf64_mmix_vec;
@@ -1020,6 +1021,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf64_ia64_big_vec,
&bfd_elf64_ia64_hpux_big_vec,
&bfd_elf64_ia64_little_vec,
+ &bfd_elf64_ia64_vms_vec,
&bfd_elf64_little_generic_vec,
&bfd_elf64_littlemips_vec,
&bfd_elf64_mmix_vec,
diff --git a/bfd/vmsutil.c b/bfd/vmsutil.c
new file mode 100644
index 0000000000..25cd889874
--- /dev/null
+++ b/bfd/vmsutil.c
@@ -0,0 +1,267 @@
+/* vmsutil.c -- Utilities for VMS.
+ Copyright 2009 Free Software Foundation, Inc.
+
+ Written by Douglas B Rupp <rupp@gnat.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "ansidecl.h"
+#include "vmsutil.h"
+
+#ifdef VMS
+#define __NEW_STARLET 1
+#include <vms/starlet.h>
+#include <vms/rms.h>
+#include <vms/atrdef.h>
+#include <vms/fibdef.h>
+#include <vms/stsdef.h>
+#include <vms/iodef.h>
+#include <vms/fatdef.h>
+#include <errno.h>
+#include <vms/descrip.h>
+#include <string.h>
+#include <unixlib.h>
+
+#define MAXPATH 256
+
+/* Descrip.h doesn't have everything... */
+typedef struct fibdef * __fibdef_ptr32 __attribute__ (( mode (SI) ));
+
+struct dsc$descriptor_fib
+{
+ unsigned int fib$l_len;
+ __fibdef_ptr32 fib$l_addr;
+};
+
+/* I/O Status Block. */
+struct IOSB
+{
+ unsigned short status, count;
+ unsigned int devdep;
+};
+
+static char *tryfile;
+
+/* Variable length string. */
+struct vstring
+{
+ short length;
+ char string[NAM$C_MAXRSS+1];
+};
+
+static char filename_buff [MAXPATH];
+static char vms_filespec [MAXPATH];
+
+/* Callback function for filespec style conversion. */
+
+static int
+translate_unix (char *name, int type ATTRIBUTE_UNUSED)
+{
+ strncpy (filename_buff, name, MAXPATH);
+ filename_buff [MAXPATH - 1] = (char) 0;
+ return 0;
+}
+
+/* Wrapper for DECC function that converts a Unix filespec
+ to VMS style filespec. */
+
+static char *
+to_vms_file_spec (char *filespec)
+{
+ strncpy (vms_filespec, "", MAXPATH);
+ decc$to_vms (filespec, translate_unix, 1, 1);
+ strncpy (vms_filespec, filename_buff, MAXPATH);
+
+ vms_filespec [MAXPATH - 1] = (char) 0;
+
+ return vms_filespec;
+}
+
+#else
+#include <sys/stat.h>
+#include <time.h>
+#define VMS_EPOCH_OFFSET 35067168000000000LL
+#define VMS_GRANULARITY_FACTOR 10000000
+#endif
+
+/* Return VMS file date, size, format, version given a name. */
+
+int
+vms_file_stats_name (const char *filename,
+ long long *cdt,
+ long *siz,
+ char *rfo,
+ int *ver)
+{
+#ifdef VMS
+ struct FAB fab;
+ struct NAM nam;
+
+ unsigned long long create;
+ FAT recattr;
+ char ascnamebuff [256];
+
+ ATRDEF atrlst[]
+ = {
+ { ATR$S_CREDATE, ATR$C_CREDATE, &create },
+ { ATR$S_RECATTR, ATR$C_RECATTR, &recattr },
+ { ATR$S_ASCNAME, ATR$C_ASCNAME, &ascnamebuff },
+ { 0, 0, 0}
+ };
+
+ FIBDEF fib;
+ struct dsc$descriptor_fib fibdsc = {sizeof (fib), (void *) &fib};
+
+ struct IOSB iosb;
+
+ long status;
+ unsigned short chan;
+
+ struct vstring file;
+ struct dsc$descriptor_s filedsc
+ = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) file.string};
+ struct vstring device;
+ struct dsc$descriptor_s devicedsc
+ = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) device.string};
+ struct vstring result;
+ struct dsc$descriptor_s resultdsc
+ = {NAM$C_MAXRSS, DSC$K_DTYPE_VT, DSC$K_CLASS_VS, (void *) result.string};
+
+ if (strcmp (filename, "<internal>") == 0
+ || strcmp (filename, "<built-in>") == 0)
+ {
+ if (cdt)
+ *cdt = 0;
+
+ if (siz)
+ *siz = 0;
+
+ if (rfo)
+ *rfo = 0;
+
+ if (ver)
+ *ver = 0;
+
+ return 0;
+ }
+
+ tryfile = to_vms_file_spec ((char *) filename);
+
+ /* Allocate and initialize a FAB and NAM structures. */
+ fab = cc$rms_fab;
+ nam = cc$rms_nam;
+
+ nam.nam$l_esa = file.string;
+ nam.nam$b_ess = NAM$C_MAXRSS;
+ nam.nam$l_rsa = result.string;
+ nam.nam$b_rss = NAM$C_MAXRSS;
+ fab.fab$l_fna = tryfile;
+ fab.fab$b_fns = strlen (tryfile);
+ fab.fab$l_nam = &nam;
+
+ /* Validate filespec syntax and device existence. */
+ status = SYS$PARSE (&fab, 0, 0);
+ if ((status & 1) != 1)
+ return 1;
+
+ file.string[nam.nam$b_esl] = 0;
+
+ /* Find matching filespec. */
+ status = SYS$SEARCH (&fab, 0, 0);
+ if ((status & 1) != 1)
+ return 1;
+
+ file.string[nam.nam$b_esl] = 0;
+ result.string[result.length=nam.nam$b_rsl] = 0;
+
+ /* Get the device name and assign an IO channel. */
+ strncpy (device.string, nam.nam$l_dev, nam.nam$b_dev);
+ devicedsc.dsc$w_length = nam.nam$b_dev;
+ chan = 0;
+ status = SYS$ASSIGN (&devicedsc, &chan, 0, 0, 0);
+ if ((status & 1) != 1)
+ return 1;
+
+ /* Initialize the FIB and fill in the directory id field. */
+ memset (&fib, 0, sizeof (fib));
+ fib.fib$w_did[0] = nam.nam$w_did[0];
+ fib.fib$w_did[1] = nam.nam$w_did[1];
+ fib.fib$w_did[2] = nam.nam$w_did[2];
+ fib.fib$l_acctl = 0;
+ fib.fib$l_wcc = 0;
+ strcpy (file.string, (strrchr (result.string, ']') + 1));
+ filedsc.dsc$w_length = strlen (file.string);
+ result.string[result.length = 0] = 0;
+
+ /* Open and close the file to fill in the attributes. */
+ status
+ = SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0,
+ &fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0);
+ if ((status & 1) != 1)
+ return 1;
+ if ((iosb.status & 1) != 1)
+ return 1;
+
+ result.string[result.length] = 0;
+ status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, &fibdsc, 0, 0, 0,
+ &atrlst, 0);
+ if ((status & 1) != 1)
+ return 1;
+ if ((iosb.status & 1) != 1)
+ return 1;
+
+ /* Deassign the channel and exit. */
+ status = SYS$DASSGN (chan);
+ if ((status & 1) != 1)
+ return 1;
+
+ if (cdt) *cdt = create;
+ if (siz) *siz = (512 * 65536 * recattr.fat$w_efblkh) +
+ (512 * (recattr.fat$w_efblkl - 1)) +
+ recattr.fat$w_ffbyte;
+ if (rfo) *rfo = recattr.fat$v_rtype;
+ if (ver) *ver = strtol (strrchr (ascnamebuff, ';')+1, 0, 10);
+
+ return 0;
+#else
+ struct stat buff;
+ struct tm *ts;
+ long gmtoff;
+
+ if ((stat (filename, &buff)) != 0)
+ return 1;
+
+ if (cdt)
+ {
+ ts = localtime (&buff.st_mtime);
+ gmtoff = ts->tm_gmtoff;
+ *cdt = (long long) (((buff.st_mtim.tv_sec + gmtoff) * VMS_GRANULARITY_FACTOR)
+ + (buff.st_mtim.tv_nsec / 100))
+ + VMS_EPOCH_OFFSET;
+ }
+
+ if (siz)
+ *siz = buff.st_size;
+
+ if (rfo)
+ *rfo = 2; /* Stream LF format. */
+
+ if (ver)
+ *ver = 0;
+
+ return 0;
+#endif
+}
+
diff --git a/bfd/vmsutil.h b/bfd/vmsutil.h
new file mode 100644
index 0000000000..6eda572086
--- /dev/null
+++ b/bfd/vmsutil.h
@@ -0,0 +1,20 @@
+/* vmsutil.h -- Header file for utilities for VMS.
+ Copyright 2009 Free Software Foundation, Inc.
+
+ Written by Douglas B Rupp <rupp@gnat.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+extern int vms_file_stats_name (const char *, long long *, long *, char *, int *);
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 60b6905612..df4a3d1e8b 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,51 @@
+2009-01-15 Douglas B Rupp <rupp@gnat.com>
+
+ * 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 <nickc@redhat.com>
PR 9722
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index cf3177087a..4c68779c98 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 18067f15fc..95db3552d6 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 a5b35fc29a..cc3f74e16a 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 3a5dcf8f13..eb104cc1e6 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 732dacd43c..7fd547654b 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 f731abb041..b5f127fc3a 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 1670041a2c..db580d88ec 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 da56dd3fc3..7c369d405b 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 */
diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h
index a5e15d93ad..49a3d995dc 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 <davidm@hpl.hp.com>
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 440a82dd7b..bae23c452f 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 63a126d6de..4d62744b8c 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 26080192c9..5646b3f13f 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 510cf7ad73..de68d717d1 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 66a21155c9..034eb8f3de 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 2702988ede..f1c02fd548 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 0000000000..7c352ac1d9
--- /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 0272b4e485..f3def28f19 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 b7857f2caa..2bcba9b41e 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 4dfc6247ec..ee943ce3ea 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 5386513553..8715db3dc0 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
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 364b3c73fe..367702b4a8 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-15 Douglas B Rupp <rupp@gnat.com>
+
+ * ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO, EF_IA_64_ARCHVER_1):
+ New macros. Minor reformatting.
+
2008-12-23 Jon Beniston <jon@beniston.com>
* lm32.h: New file.
diff --git a/include/elf/ia64.h b/include/elf/ia64.h
index d86d6304bb..40054434c7 100644
--- a/include/elf/ia64.h
+++ b/include/elf/ia64.h
@@ -1,5 +1,5 @@
/* IA-64 ELF support for BFD.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2008
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2008, 2009
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
@@ -24,8 +24,9 @@
/* Bits in the e_flags field of the Elf64_Ehdr: */
-#define EF_IA_64_MASKOS 0x0000000f /* OS-specific flags. */
-#define EF_IA_64_ARCH 0xff000000 /* Arch. version mask. */
+#define EF_IA_64_MASKOS 0x0000000f /* OS-specific flags. */
+#define EF_IA_64_ARCH 0xff000000 /* Arch. version mask. */
+#define EF_IA_64_ARCHVER_1 (1 << 24) /* Arch. version level 1 compat. */
/* ??? These four definitions are not part of the SVR4 ABI.
They were present in David's initial code drop, so it is probable
@@ -84,22 +85,24 @@
/* OpenVMS section types. */
/* The section contains PC-to-source correlation information for use by the
VMS RTL's traceback facility. */
-#define SHT_IA_64_VMS_TRACE 0x60000000
+#define SHT_IA_64_VMS_TRACE 0x60000000
/* The section contains routine signature information for use by the
translated image executive. */
-#define SHT_IA_64_VMS_TIE_SIGNATURES 0x60000001
+#define SHT_IA_64_VMS_TIE_SIGNATURES 0x60000001
/* The section contains dwarf-3 information. */
-#define SHT_IA_64_VMS_DEBUG 0x60000002
+#define SHT_IA_64_VMS_DEBUG 0x60000002
/* The section contains the dwarf-3 string table. */
-#define SHT_IA_64_VMS_DEBUG_STR 0x60000003
+#define SHT_IA_64_VMS_DEBUG_STR 0x60000003
/* The section contains linkage information to perform consistency checking
accross object modules. */
-#define SHT_IA_64_VMS_LINKAGES 0x60000004
+#define SHT_IA_64_VMS_LINKAGES 0x60000004
/* The section allows the symbol vector in an image to be location through
the section table. */
-#define SHT_IA_64_VMS_SYMBOL_VECTOR 0x60000005
+#define SHT_IA_64_VMS_SYMBOL_VECTOR 0x60000005
/* The section contains inter-image fixups. */
-#define SHT_IA_64_VMS_FIXUP 0x60000006
+#define SHT_IA_64_VMS_FIXUP 0x60000006
+/* The section contains unmangled name info. */
+#define SHT_IA_64_VMS_DISPLAY_NAME_INFO 0x60000007
/* Bits in the p_flags field of Elf64_Phdr: */