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.
+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
vms-hdr.lo \
vms-misc.lo \
vms-tir.lo \
+ vmsutil.lo \
xcofflink.lo \
xsym.lo \
xtensa-isa.lo \
vms-hdr.c \
vms-misc.c \
vms-tir.c \
+ vmsutil.c \
xcofflink.c \
xsym.c \
xtensa-isa.c \
$(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
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"
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 ;;
/* 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.
PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
int suffix_length;
int type;
- int attr;
+ bfd_vma attr;
};
enum action_discarded
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;
/* 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.
}
}
+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);
+}
\f
#define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec
#define TARGET_LITTLE_NAME "elfNN-ia64-little"
#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"
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;
&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,
--- /dev/null
+/* 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
+}
+
--- /dev/null
+/* 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 *);
+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
/* 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.
void
obj_elf_change_section (const char *name,
int type,
- int attr,
+ bfd_vma attr,
int entsize,
const char *group_name,
int linkonce,
#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)
{
{
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
return 0;
}
-static int
+static bfd_vma
obj_elf_section_word (char *str, size_t len, int *type)
{
int ret;
#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
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;
/* 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.
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);
#ifdef OBJ_ELF
/* Map 's' to SHF_ALPHA_GPREL. */
-int
+bfd_vma
alpha_elf_section_letter (int letter, char **ptr_msg)
{
if (letter == 's')
/* 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;
#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
#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)
#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)
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"))
#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)
/* 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.
#include "opcode/ia64.h"
#include "elf/ia64.h"
+#include "bfdver.h"
+#include <time.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
/* 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;
flagword
ia64_elf_section_flags (flagword flags,
- int attr,
+ bfd_vma attr,
int type ATTRIBUTE_UNUSED)
{
if (attr & SHF_IA_64_SHORT)
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;
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
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);
}
{
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 */
/* 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.
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);
#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
}
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.
#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 *);
return 1;
}
-int
+bfd_vma
mep_elf_section_letter (int letter, char **ptrmsg)
{
if (letter == 'v')
}
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;
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 },
#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')
return -1;
}
-int
+bfd_vma
ppc_section_word (char *str, size_t len)
{
if (len == 7 && strncmp (str, "exclude", 7) == 0)
}
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;
#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)
--- /dev/null
+#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; \
+ })
+
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 ;;
# 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"
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')
for (i = 1; i < files_in_use; ++i)
{
+ const char *fullfilename;
+
if (files[i].filename == NULL)
{
as_bad (_("unassigned file number %ld"), (long) i);
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. */
/* 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);
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
+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.
/* 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>
/* 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
/* 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: */