diff options
author | Nick Clifton <nickc@redhat.com> | 2002-03-18 12:46:27 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2002-03-18 12:46:27 +0000 |
commit | eb1e0e807ac769f624181bc44acdcd79d866949d (patch) | |
tree | ddd5259b49eb8431b5e2bd8f9f84e6ea7b0e5cc3 /bfd | |
parent | a1c259a138165fa878430144c8658093d6ac2256 (diff) | |
download | gdb-eb1e0e807ac769f624181bc44acdcd79d866949d.zip gdb-eb1e0e807ac769f624181bc44acdcd79d866949d.tar.gz gdb-eb1e0e807ac769f624181bc44acdcd79d866949d.tar.bz2 |
Add AIX 64 shared library support and emulation layer for binutils
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 34 | ||||
-rw-r--r-- | bfd/Makefile.am | 14 | ||||
-rw-r--r-- | bfd/Makefile.in | 16 | ||||
-rw-r--r-- | bfd/aix5ppc-core.c | 359 | ||||
-rw-r--r-- | bfd/bfd-in.h | 3 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 207 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 386 | ||||
-rw-r--r-- | bfd/coffcode.h | 21 | ||||
-rw-r--r-- | bfd/config.bfd | 13 | ||||
-rwxr-xr-x | bfd/configure | 166 | ||||
-rw-r--r-- | bfd/configure.in | 36 | ||||
-rw-r--r-- | bfd/doc/Makefile.in | 2 | ||||
-rw-r--r-- | bfd/libxcoff.h | 73 | ||||
-rw-r--r-- | bfd/reloc.c | 198 | ||||
-rw-r--r-- | bfd/rs6000-core.c | 24 | ||||
-rw-r--r-- | bfd/targets.c | 1 | ||||
-rw-r--r-- | bfd/xcofflink.c | 79 |
17 files changed, 1197 insertions, 435 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 10f6f17..ab7b7d0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,37 @@ +2002-03-18 Tom Rix <trix@redhat.com> + + * aix5ppc.core.c : New file for AIX 5 64 bit core support. + * bfd-in.h : Add bfd_xcoff_ar_archive_set_magic declaration. + * coff-rs6000 (do_pad) : New function for archive padding. + (do_copy) : New function for object file copying in archives. + (do_shared_object_padding) : New function for padding shared + objects to their text section alignment in archives. + (bfd_xcoff_ar_achive_set_magic) : Stub. + (xcoff_write_armap_big) : Use do_copy and do_pad. + (xcoff_write_archive_contents_big) : Use do_shared_object_padding, + do_copy and do_pad. + * coff64-rs6000.c (xcoff64_write_ojbect_contents) : Use + bfd_xcoff_magic_number. + (xcoff64_bad_format_hook) : New function for _bfd_bad_format_hook + fop. + (xcoff_backend_data_r) : Use xcoff64_bad_format_hook. + (bfd_xcoff_aix5_backend_data) : New Aix 5 backend data. + (aix5coff64_vec) : New Aix 5 target aix5coff64-rs6000. + * rs6000-core.c : Update copyright date. + * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL + csectpp. + * coffcode.h (coff_new_section_hook) : Use new accessor macros. + (coff_set_arch_mach_hook) : Add Aix 5 U64_TOCMAGIC magic #. + (coff_set_flags) : Use bfd_xcoff_magic_number. + * libxcoff.h (bfd_xcoff_is_xcoff64): Add U64_TOCMAGIC. + * configure.in : Add powerpc-*-aix5 and rs6000-*-aix5 support. + * Makefile.am : Same. + * config.bfd : Same. + * targets.c : Same. + * configure : Regnerate. + * Makefile.in : Same. + * bfd-in2.h : Same. + 2002-03-18 Nick Clifton <nickc@cambridge.redhat.com> * po/fr.po: Updated version. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index fdeb6e6..42012db 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -441,6 +441,7 @@ BFD32_BACKENDS_CFILES = \ # target_vector in targets.c if configured with --enable-targets=all # and --enable-64-bit-bfd. BFD64_BACKENDS = \ + aix5ppc-core.lo \ aout64.lo \ coff-alpha.lo \ coff64-rs6000.lo \ @@ -464,6 +465,7 @@ BFD64_BACKENDS = \ pepigen.lo BFD64_BACKENDS_CFILES = \ + aix5ppc-core.c \ aout64.c \ coff-alpha.c \ coff64-rs6000.c \ @@ -1139,11 +1141,6 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h -elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ - elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1160,6 +1157,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1367,6 +1369,8 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h +aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h libcoff.h libxcoff.h aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 716b439..cb4248f 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -571,6 +571,7 @@ BFD32_BACKENDS_CFILES = \ # target_vector in targets.c if configured with --enable-targets=all # and --enable-64-bit-bfd. BFD64_BACKENDS = \ + aix5ppc-core.lo \ aout64.lo \ coff-alpha.lo \ coff64-rs6000.lo \ @@ -595,6 +596,7 @@ BFD64_BACKENDS = \ BFD64_BACKENDS_CFILES = \ + aix5ppc-core.c \ aout64.c \ coff-alpha.c \ coff64-rs6000.c \ @@ -750,7 +752,7 @@ configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -1683,11 +1685,6 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h -elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ - elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1704,6 +1701,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1911,6 +1913,8 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h +aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h libcoff.h libxcoff.h aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c new file mode 100644 index 0000000..5ba182f --- /dev/null +++ b/bfd/aix5ppc-core.c @@ -0,0 +1,359 @@ +/* IBM RS/6000 "XCOFF" back-end for BFD. + Copyright 2001, 2002 + Free Software Foundation, Inc. + Written by Tom Rix + Contributed by Redhat. + + This file is part of BFD, the Binary File Descriptor library. + + 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 2 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., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +#include "bfd.h" + +#ifdef AIX_5_CORE + +#include "sysdep.h" +#include "libbfd.h" + +const bfd_target * xcoff64_core_p PARAMS ((bfd *)); +boolean xcoff64_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); +char * xcoff64_core_file_failing_command PARAMS ((bfd *)); +int xcoff64_core_file_failing_signal PARAMS ((bfd *)); + +/* Aix 5.1 system include file. */ + +/* Need to define this macro so struct ld_info64 get included. */ +#define __LDINFO_PTRACE64__ +#include <sys/ldr.h> +#include <core.h> + +#define core_hdr(abfd) ((struct core_dumpxx *) abfd->tdata.any) + +#define CHECK_FILE_OFFSET(s, v) \ + ((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size) + +const bfd_target * +xcoff64_core_p (abfd) + bfd *abfd; +{ + struct core_dumpxx core, *new_core_hdr; + struct stat statbuf; + asection *sec; + struct __ld_info64 ldinfo; + bfd_vma ld_offset; + bfd_size_type i; + struct vm_infox vminfo; + bfd_target *return_value = NULL; + + /* Get the header. */ + if (bfd_seek (abfd, 0, SEEK_SET) != 0) + goto xcoff64_core_p_error; + + if (sizeof (struct core_dumpxx) + != bfd_read (&core, sizeof (struct core_dumpxx), 1, abfd)) + goto xcoff64_core_p_error; + + if (bfd_stat (abfd, &statbuf) < 0) + goto xcoff64_core_p_error; + + /* Sanity checks + c_flag has CORE_VERSION_1, Aix 4+ + c_entries = 0 for Aix 4.3+ + IS_PROC64 is a macro defined in procinfo.h, test for 64 bit process. + + We will still be confused if a Aix 4.3 64 bit core file is + copied over to a Aix 5 machine. + + Check file header offsets + + See rs6000-core.c for comment on size of core + If there isn't enough of a real core file, bail. */ + + if ((CORE_VERSION_1 != (core.c_flag & CORE_VERSION_1)) + || (0 != core.c_entries) + || (! (IS_PROC64 (&core.c_u.U_proc))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_fdsinfox))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_loader))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_loader + core.c_lsize))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_thr))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_segregion))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_stack))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_stack + core.c_size))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_data))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_data + core.c_datasize))) + || (! (core.c_flag & UBLOCK_VALID)) + || (! (core.c_flag & LE_VALID))) + goto xcoff64_core_p_error; + + /* Check for trucated stack or general truncating. */ + if ((! (core.c_flag & USTACK_VALID)) + || (core.c_flag & CORE_TRUNC)) + { + bfd_set_error (bfd_error_file_truncated); + + return return_value; + } + + new_core_hdr = (struct core_dumpxx *) + bfd_zalloc (abfd, sizeof (struct core_dumpxx)); + if (NULL == new_core_hdr) + return return_value; + + memcpy (new_core_hdr, &core, sizeof (struct core_dumpxx)); + core_hdr(abfd) = (char *)new_core_hdr; + + /* .stack section. */ + sec = bfd_make_section_anyway (abfd, ".stack"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = core.c_size; + sec->vma = core.c_stackorg; + sec->filepos = core.c_stack; + + /* .reg section for all registers. */ + sec = bfd_make_section_anyway (abfd, ".reg"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY; + sec->_raw_size = sizeof (struct __context64); + sec->vma = 0; + sec->filepos = 0; + sec->contents = (bfd_byte *)&new_core_hdr->c_flt.r64; + + /* .ldinfo section. + To actually find out how long this section is in this particular + core dump would require going down the whole list of struct + ld_info's. See if we can just fake it. */ + sec = bfd_make_section_anyway (abfd, ".ldinfo"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_HAS_CONTENTS; + sec->_raw_size = core.c_lsize; + sec->vma = 0; + sec->filepos = core.c_loader; + + /* AIX 4 adds data sections from loaded objects to the core file, + which can be found by examining ldinfo, and anonymously mmapped + regions. */ + + /* .data section from executable. */ + sec = bfd_make_section_anyway (abfd, ".data"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = core.c_datasize; + sec->vma = core.c_dataorg; + sec->filepos = core.c_data; + + /* .data sections from loaded objects. */ + ld_offset = core.c_loader; + + while (1) + { + if (bfd_seek (abfd, ld_offset, SEEK_SET) != 0) + return return_value; + + if (sizeof (struct __ld_info64) != + bfd_read (&ldinfo, sizeof (struct __ld_info64), 1, abfd)) + return return_value; + + if (ldinfo.ldinfo_core) + { + sec = bfd_make_section_anyway (abfd, ".data"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = ldinfo.ldinfo_datasize; + sec->vma = ldinfo.ldinfo_dataorg; + sec->filepos = ldinfo.ldinfo_core; + } + + if (0 == ldinfo.ldinfo_next) + break; + ld_offset += ldinfo.ldinfo_next; + } + + /* .vmdata sections from anonymously mmapped regions. */ + if (core.c_vmregions) + { + if (bfd_seek (abfd, core.c_vmm, SEEK_SET) != 0) + return return_value; + + for (i = 0; i < core.c_vmregions; i++) + if (sizeof (struct vm_infox) != + bfd_read (&vminfo, sizeof (struct vm_infox), 1, abfd)) + return return_value; + + if (vminfo.vminfo_offset) + { + sec = bfd_make_section_anyway (abfd, ".vmdata"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = vminfo.vminfo_size; + sec->vma = vminfo.vminfo_addr; + sec->filepos = vminfo.vminfo_offset; + } + } + + return_value = abfd->xvec; /* This is garbage for now. */ + + xcoff64_core_p_error: + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + + return return_value; +} + +/* Return `true' if given core is from the given executable. */ + +boolean +xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd; + bfd *exec_bfd; +{ + struct core_dumpxx core; + char *path, *s; + size_t alloc; + const char *str1, *str2; + boolean return_value = false; + + /* Get the header. */ + if (bfd_seek (core_bfd, 0, SEEK_SET) != 0) + return return_value; + + if (sizeof (struct core_dumpxx) != + bfd_read (&core, sizeof (struct core_dumpxx), 1, core_bfd)) + return return_value; + + if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0) + return return_value; + + alloc = 100; + path = bfd_malloc (alloc); + if (path == NULL) + return return_value; + + s = path; + + while (1) + { + if (bfd_read (s, 1, 1, core_bfd) != 1) + goto xcoff64_core_file_matches_executable_p_end_1; + + if (*s == '\0') + break; + ++s; + if (s == path + alloc) + { + char *n; + + alloc *= 2; + n = bfd_realloc (path, alloc); + if (n == NULL) + goto xcoff64_core_file_matches_executable_p_end_1; + + s = n + (path - s); + path = n; + } + } + + str1 = strrchr (path, '/'); + str2 = strrchr (exec_bfd->filename, '/'); + + /* Step over character '/'. */ + str1 = str1 != NULL ? str1 + 1 : path; + str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename; + + if (strcmp (str1, str2) == 0) + return_value = true; + + xcoff64_core_file_matches_executable_p_end_1: + free (path); + return return_value; +} + +char * +xcoff64_core_file_failing_command (abfd) + bfd *abfd; +{ + struct core_dumpxx *c = core_hdr (abfd); + char *return_value = 0; + + if (NULL != c) + return_value = c->c_u.U_proc.pi_comm; + + return return_value; +} + +int +xcoff64_core_file_failing_signal (abfd) + bfd *abfd; +{ + struct core_dumpxx *c = core_hdr (abfd); + int return_value = 0; + + if (NULL != c) + return_value = c->c_signo; + + return return_value; +} + +#else /* AIX_5_CORE */ + +const bfd_target * xcoff64_core_p PARAMS ((bfd *)); +boolean xcoff64_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); +char * xcoff64_core_file_failing_command PARAMS ((bfd *)); +int xcoff64_core_file_failing_signal PARAMS ((bfd *)); + +const bfd_target * +xcoff64_core_p (abfd) + bfd *abfd; +{ + bfd_set_error (bfd_error_wrong_format); + return 0; +} + +boolean +xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd; + bfd *exec_bfd; +{ + return false; +} + +char * +xcoff64_core_file_failing_command (abfd) + bfd *abfd; +{ + return 0; +} + +int +xcoff64_core_file_failing_signal (abfd) + bfd *abfd; +{ + return 0; +} + +#endif /* AIX_5_CORE */ diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 5c21e1d..81cc801 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -749,6 +749,9 @@ extern boolean bfd_xcoff_size_dynamic_sections extern boolean bfd_xcoff_link_generate_rtinit PARAMS ((bfd *, const char *, const char *, boolean)); +/* XCOFF support routines for ar. */ +extern boolean bfd_xcoff_ar_archive_set_magic PARAMS ((bfd *, char *)); + /* Externally visible COFF routines. */ #if defined(__STDC__) || defined(ALMOST_STDC) diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index c01c1b1..eed3ee6 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -145,6 +145,9 @@ static bfd_vma xcoff_loader_reloc_offset PARAMS ((bfd *, struct internal_ldhdr *)); static boolean xcoff_generate_rtinit PARAMS((bfd *, const char *, const char *, boolean)); +static boolean do_pad PARAMS((bfd *, unsigned int)); +static boolean do_copy PARAMS((bfd *, bfd *)); +static boolean do_shared_object_padding PARAMS ((bfd *, bfd *, ufile_ptr *, int)); /* We use our own tdata type. Its first field is the COFF tdata type, so the COFF routines are compatible. */ @@ -988,7 +991,17 @@ _bfd_xcoff_reloc_type_lookup (abfd, code) /* XCOFF archives use this as a magic string. Note that both strings have the same length. */ +/* Set the magic for archive. */ +boolean +bfd_xcoff_ar_archive_set_magic (abfd, magic) + bfd *abfd ATTRIBUTE_UNUSED; + char *magic ATTRIBUTE_UNUSED; +{ + /* Not supported yet. */ + return false; + /* bfd_xcoff_archive_set_magic (abfd, magic); */ +} /* Read in the armap of an XCOFF archive. */ @@ -1573,6 +1586,85 @@ static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1]; (v) = bfd_scan_vma (buff20, (const char **) NULL, 10) static boolean +do_pad (abfd, number) + bfd *abfd; + unsigned int number; +{ + bfd_byte b = 0; + + /* Limit pad to <= 4096. */ + if (number > 4096) + return false; + + while (number--) + if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + return false; + + return true; +} + +static boolean +do_copy (out_bfd, in_bfd) + bfd *out_bfd; + bfd *in_bfd; +{ + bfd_size_type remaining; + bfd_byte buffer[DEFAULT_BUFFERSIZE]; + + if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0) + return false; + + remaining = arelt_size (in_bfd); + + while (remaining >= DEFAULT_BUFFERSIZE) + { + if (bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE + || bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE) + return false; + + remaining -= DEFAULT_BUFFERSIZE; + } + + if (remaining) + { + if (bfd_bread (buffer, remaining, in_bfd) != remaining + || bfd_bwrite (buffer, remaining, out_bfd) != remaining) + return false; + } + + return true; +} + +static boolean +do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size) + bfd *out_bfd; + bfd *in_bfd; + ufile_ptr *offset; + int ar_header_size; +{ + if (bfd_check_format (in_bfd, bfd_object) + && bfd_get_flavour (in_bfd) == bfd_target_xcoff_flavour + && (in_bfd->flags & DYNAMIC) != 0) + { + bfd_size_type pad = 0; + int text_align_power; + + text_align_power = bfd_xcoff_text_align_power (in_bfd); + BFD_ASSERT (2 < text_align_power); + + pad = 1 << text_align_power; + pad -= (*offset + ar_header_size) & (pad - 1); + + if (! do_pad (out_bfd, pad)) + return false; + + *offset += pad; + } + + return true; +} + +static boolean xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd *abfd; unsigned int elength ATTRIBUTE_UNUSED; @@ -2001,28 +2093,12 @@ xcoff_write_archive_contents_old (abfd) if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0) return false; - while (remaining != 0) - { - bfd_size_type amt; - bfd_byte buffer[DEFAULT_BUFFERSIZE]; - - amt = sizeof buffer; - if (amt > remaining) - amt = remaining; - if (bfd_bread (buffer, amt, sub) != amt - || bfd_bwrite (buffer, amt, abfd) != amt) - return false; - remaining -= amt; - } - - if ((size & 1) != 0) - { - bfd_byte b; - b = '\0'; - if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) - return false; - } + if (! do_copy (abfd, sub)) + return false; + + if (! do_pad (abfd, size & 1)) + return false; } sprintf (fhdr.lastmemoff, "%ld", (long) prevoff); @@ -2089,14 +2165,9 @@ xcoff_write_archive_contents_old (abfd) if (bfd_bwrite ((PTR) name, namlen + 1, abfd) != namlen + 1) return false; } - if ((size & 1) != 0) - { - bfd_byte b; - b = '\0'; - if (bfd_bwrite ((PTR) &b, (bfd_size_type) 1, abfd) != 1) - return false; - } + if (! do_pad (abfd, size & 1)) + return false; /* Write out the armap, if appropriate. */ if (! makemap || ! hasobjects) @@ -2143,15 +2214,26 @@ xcoff_write_archive_contents_big (abfd) bfd_byte *member_table, *mt; bfd_vma member_table_size; + memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG); memcpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG); - PRINT20 (fhdr.firstmemoff, SIZEOF_AR_FILE_HDR_BIG); - PRINT20 (fhdr.freeoff, 0); - /* Calculate count and total_namlen */ + if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) + return false; + + /* Calculate count and total_namlen. */ + makemap = bfd_has_map (abfd); + hasobjects = false; for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0; current_bfd != NULL; current_bfd = current_bfd->next, count++) - total_namlen += strlen (normalize_filename (current_bfd)) + 1; + { + total_namlen += strlen (normalize_filename (current_bfd)) + 1; + + if (makemap + && ! hasobjects + && bfd_check_format (current_bfd, bfd_object)) + hasobjects = true; + } offsets = NULL; if (count) @@ -2160,11 +2242,7 @@ xcoff_write_archive_contents_big (abfd) if (offsets == NULL) return false; } - if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) - return false; - makemap = bfd_has_map (abfd); - hasobjects = false; prevoff = 0; nextoff = SIZEOF_AR_FILE_HDR_BIG; for (current_bfd = abfd->archive_head, i = 0; @@ -2176,12 +2254,6 @@ xcoff_write_archive_contents_big (abfd) struct xcoff_ar_hdr_big *ahdrp; bfd_size_type remaining; - if (makemap && ! hasobjects) - { - if (bfd_check_format (current_bfd, bfd_object)) - hasobjects = true; - } - name = normalize_filename (current_bfd); namlen = strlen (name); @@ -2236,6 +2308,14 @@ xcoff_write_archive_contents_big (abfd) BFD_ASSERT (nextoff == bfd_tell (abfd)); + /* Check for xcoff shared objects. + Their text section needs to be aligned wrt the archive file position. + This requires extra padding before the archive header. */ + if (! do_shared_object_padding (abfd, current_bfd, & nextoff, + SIZEOF_AR_HDR_BIG + namlen + + SXCOFFARFMAG)) + return false; + offsets[i] = nextoff; prevoff = nextoff; @@ -2252,31 +2332,19 @@ xcoff_write_archive_contents_big (abfd) if (bfd_seek (current_bfd, (file_ptr) 0, SEEK_SET) != 0) return false; - while (remaining != 0) - { - bfd_size_type amt; - bfd_byte buffer[DEFAULT_BUFFERSIZE]; - - amt = sizeof buffer; - if (amt > remaining) - amt = remaining; - if (bfd_bread (buffer, amt, current_bfd) != amt - || bfd_bwrite (buffer, amt, abfd) != amt) - return false; - remaining -= amt; - } - if ((size & 1) != 0) - { - bfd_byte b; - - b = '\0'; - if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) - return false; - } + if (! do_copy (abfd, current_bfd)) + return false; + + if (! do_pad (abfd, size & 1)) + return false; } - PRINT20 (fhdr.lastmemoff, prevoff); + if (count) + { + PRINT20 (fhdr.firstmemoff, offsets[0]); + PRINT20 (fhdr.lastmemoff, prevoff); + } /* Write out the member table. Layout : @@ -3455,14 +3523,11 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = SMALL_AOUTSZ, /* _xcoff_small_aout_header_size */ /* Versions. */ - 1, /* _xcoff_ldhdr_version */ + 1, /* _xcoff_ldhdr_version */ - /* Xcoff vs xcoff64 putting symbol names. */ _bfd_xcoff_put_symbol_name, /* _xcoff_put_symbol_name */ - _bfd_xcoff_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */ - - & xcoff_dynamic_reloc, /* dynamic reloc howto */ - + _bfd_xcoff_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */ + & xcoff_dynamic_reloc, /* dynamic reloc howto */ xcoff_create_csect_from_smclas, /* _xcoff_create_csect_from_smclas */ /* Lineno and reloc count overflow. */ @@ -3481,7 +3546,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = xcoff_generate_rtinit, /* _xcoff_generate_rtinit */ }; -/* The transfer vector that leads the outside world to all of the above. */ +/* The transfer vector that leads the outside world to all of the above. */ const bfd_target rs6000coff_vec = { "aixcoff-rs6000", diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 9758afd..0248daa 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -4,21 +4,21 @@ Written Clinton Popetz. Contributed by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -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 2 of the License, or -(at your option) any later version. + 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 2 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. + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -130,7 +130,7 @@ static boolean xcoff64_write_object_contents PARAMS ((bfd *)); static boolean xcoff64_ppc_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, - asection **sections)); + asection **)); static boolean xcoff64_slurp_armap PARAMS ((bfd *)); static const bfd_target *xcoff64_archive_p PARAMS ((bfd *)); static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *)); @@ -144,9 +144,10 @@ static bfd_vma xcoff64_loader_symbol_offset static bfd_vma xcoff64_loader_reloc_offset PARAMS ((bfd *, struct internal_ldhdr *)); static boolean xcoff64_generate_rtinit - PARAMS((bfd *, const char *, const char *, boolean)); + PARAMS ((bfd *, const char *, const char *, boolean)); +static boolean xcoff64_bad_format_hook PARAMS ((bfd *, PTR )); -/* coffcode.h needs these to be defined */ +/* coffcode.h needs these to be defined. */ /* Internalcoff.h and coffcode.h modify themselves based on these flags. */ #define XCOFF64 #define RS6000COFF_C 1 @@ -453,9 +454,12 @@ _bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) } static boolean -_bfd_xcoff64_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab, - struct internal_syment *sym, - const char *name) { +_bfd_xcoff64_put_symbol_name (abfd, strtab, sym, name) + bfd *abfd; + struct bfd_strtab_hash *strtab; + struct internal_syment *sym; + const char *name; +{ boolean hash; bfd_size_type indx; @@ -482,7 +486,6 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name) struct internal_ldsym *ldsym; const char *name; { - size_t len; len = strlen (name); @@ -668,7 +671,7 @@ xcoff64_write_object_contents (abfd) return false; } - /* Work out the size of the reloc and linno areas */ + /* Work out the size of the reloc and linno areas. */ reloc_base = obj_relocbase (abfd); for (current = abfd->sections; current != NULL; current = current->next) @@ -677,12 +680,12 @@ xcoff64_write_object_contents (abfd) lineno_base = reloc_base + reloc_size; /* Make a pass through the symbol table to count line number entries and - put them into the correct asections */ + put them into the correct asections. */ lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd); sym_base = lineno_base + lnno_size; - /* Indicate in each section->line_filepos its actual file address */ + /* Indicate in each section->line_filepos its actual file address. */ for (current = abfd->sections; current != NULL; current = current->next) { if (current->lineno_count) @@ -792,7 +795,7 @@ xcoff64_write_object_contents (abfd) if (abfd->flags & EXEC_P) internal_f.f_flags |= F_EXEC; - /* FIXME: this is wrong for PPC_PE! */ + /* FIXME: this is wrong for PPC_PE! */ if (bfd_little_endian (abfd)) internal_f.f_flags |= F_AR32WR; else @@ -805,11 +808,7 @@ xcoff64_write_object_contents (abfd) memset (&internal_a, 0, sizeof internal_a); - - /* This can only be called from the xcoff64 backend so the magic # - must be for xcoff64. */ - internal_f.f_magic = 0757; - + internal_f.f_magic = bfd_xcoff_magic_number (abfd); internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC : (abfd->flags & WP_TEXT) ? RS6K_AOUTHDR_NMAGIC : RS6K_AOUTHDR_OMAGIC; @@ -817,7 +816,7 @@ xcoff64_write_object_contents (abfd) /* FIXME: Does anybody ever set this to another value? */ internal_a.vstamp = 0; - /* Now should write relocs, strings, syms */ + /* Now should write relocs, strings, syms. */ obj_sym_filepos (abfd) = sym_base; internal_f.f_symptr = 0; @@ -1362,7 +1361,6 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, return true; } - /* The XCOFF reloc table. Actually, XCOFF relocations specify the bitsize and whether they are signed or not, along with a @@ -1370,7 +1368,6 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, different algorithms for putting in the reloc. Many of these relocs need special_function entries, which I have not written. */ - reloc_howto_type xcoff64_howto_table[] = { /* Standard 64 bit relocation. */ @@ -1800,8 +1797,6 @@ xcoff64_reloc_type_lookup (abfd, code) } } - - /* Read in the armap of an XCOFF archive. */ static boolean @@ -2114,6 +2109,23 @@ xcoff64_loader_reloc_offset (abfd, ldhdr) return (ldhdr->l_rldoff); } +static boolean +xcoff64_bad_format_hook (abfd, filehdr) + bfd * abfd; + PTR filehdr; +{ + struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + + /* Check flavor first. */ + if (bfd_get_flavour (abfd) != bfd_target_xcoff_flavour) + return false; + + if (bfd_xcoff_magic_number (abfd) != internal_f->f_magic) + return false; + + return true; +} + static boolean xcoff64_generate_rtinit (abfd, init, fini, rtld) bfd *abfd; @@ -2151,7 +2163,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) initsz = (init == NULL ? 0 : 1 + strlen (init)); finisz = (fini == NULL ? 0 : 1 + strlen (fini)); - /* file header */ + /* File header. */ memset (filehdr_ext, 0, FILHSZ); memset (&filehdr, 0, sizeof (struct internal_filehdr)); filehdr.f_magic = bfd_xcoff_magic_number (abfd); @@ -2162,10 +2174,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) filehdr.f_opthdr = 0; filehdr.f_flags = 0; - /* section headers */ + /* Section headers. */ memset (scnhdr_ext, 0, 3 * SCNHSZ); - /* text */ + /* Text. */ memset (&text_scnhdr, 0, sizeof (struct internal_scnhdr)); memcpy (text_scnhdr.s_name, text_name, strlen (text_name)); text_scnhdr.s_paddr = 0; @@ -2178,7 +2190,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) text_scnhdr.s_nlnno = 0; text_scnhdr.s_flags = STYP_TEXT; - /* data */ + /* Data. */ memset (&data_scnhdr, 0, sizeof (struct internal_scnhdr)); memcpy (data_scnhdr.s_name, data_name, strlen (data_name)); data_scnhdr.s_paddr = 0; @@ -2191,7 +2203,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) data_scnhdr.s_nlnno = 0; data_scnhdr.s_flags = STYP_DATA; - /* bss */ + /* Bss. */ memset (&bss_scnhdr, 0, sizeof (struct internal_scnhdr)); memcpy (bss_scnhdr.s_name, bss_name, strlen (bss_name)); bss_scnhdr.s_paddr = 0; /* set below */ @@ -2262,7 +2274,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) data_scnhdr.s_size = data_buffer_size; bss_scnhdr.s_paddr = bss_scnhdr.s_vaddr = data_scnhdr.s_size; - /* string table */ + /* String table. */ string_table_size = 4; string_table_size += strlen (data_name) + 1; string_table_size += strlen (rtinit_name) + 1; @@ -2326,7 +2338,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]); filehdr.f_nsyms += 2; - /* init */ + /* Init. */ if (initsz) { memset (&syment, 0, sizeof (struct internal_syment)); @@ -2343,7 +2355,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0, syment.n_numaux, &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]); - /* reloc */ + /* Reloc. */ memset (&reloc, 0, sizeof (struct internal_reloc)); reloc.r_vaddr = 0x0018; reloc.r_symndx = filehdr.f_nsyms; @@ -2355,7 +2367,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) data_scnhdr.s_nreloc += 1; } - /* finit */ + /* Finit. */ if (finisz) { memset (&syment, 0, sizeof (struct internal_syment)); @@ -2373,7 +2385,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) syment.n_numaux, &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]); - /* reloc */ + /* Reloc. */ memset (&reloc, 0, sizeof (struct internal_reloc)); reloc.r_vaddr = 0x0038; reloc.r_symndx = filehdr.f_nsyms; @@ -2403,7 +2415,7 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) syment.n_numaux, &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]); - /* reloc */ + /* Reloc. */ memset (&reloc, 0, sizeof (struct internal_reloc)); reloc.r_vaddr = 0x0000; reloc.r_symndx = filehdr.f_nsyms; @@ -2471,7 +2483,7 @@ static unsigned long xcoff64_glink_code[10] = static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = { - { /* COFF backend, defined in libcoff.h */ + { /* COFF backend, defined in libcoff.h. */ _bfd_xcoff64_swap_aux_in, /* _bfd_coff_swap_aux_in */ _bfd_xcoff64_swap_sym_in, /* _bfd_coff_swap_sym_in */ _bfd_xcoff64_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ @@ -2492,19 +2504,19 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = FILNMLEN, /* _bfd_filnmlen */ true, /* _bfd_coff_long_filenames */ false, /* _bfd_coff_long_section_names */ - (3), /* _bfd_coff_default_section_alignment_power */ - true, /* _bfd_coff_force_symnames_in_strings */ - 4, /* _bfd_coff_debug_string_prefix_length */ + (3), /* _bfd_coff_default_section_alignment_power */ + true, /* _bfd_coff_force_symnames_in_strings */ + 4, /* _bfd_coff_debug_string_prefix_length */ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ coff_swap_reloc_in, /* _bfd_reloc_in */ - coff_bad_format_hook, /* _bfd_bad_format_hook */ + xcoff64_bad_format_hook, /* _bfd_bad_format_hook */ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ coff_mkobject_hook, /* _bfd_mkobject_hook */ styp_to_sec_flags, /* _bfd_syp_to_sec_flags */ coff_set_alignment_hook, /* _bfd_set_alignment_hook */ - coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ + coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ symname_in_debug_hook, /* _coff_symname_in_debug_hook */ coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */ coff_print_aux, /* bfd_coff_print_aux */ @@ -2514,7 +2526,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = /* _bfd_coff_compute_section_file_positions */ coff_compute_section_file_positions, NULL , /* _bfd_coff_start_final_link */ - xcoff64_ppc_relocate_section, /* _bfd_coff_relocate_section */ + xcoff64_ppc_relocate_section, /* _bfd_coff_relocate_section */ coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */ NULL , /* _bfd_coff_addust_symndx */ _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */ @@ -2526,7 +2538,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = bfd_arch_powerpc, /* architecture */ bfd_mach_ppc_620, /* machine */ - /* function pointers to xcoff specific swap routines */ + /* Function pointers to xcoff specific swap routines. */ xcoff64_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */ xcoff64_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */ xcoff64_swap_ldsym_in, /* _xcoff_swap_ldsym_in */ @@ -2534,41 +2546,42 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = xcoff64_swap_ldrel_in, /* _xcoff_swap_ldrel_in */ xcoff64_swap_ldrel_out, /* _xcoff_swap_ldrel_out */ - /* sizes */ + /* Sizes. */ LDHDRSZ, /* _xcoff_ldhdrsz */ LDSYMSZ, /* _xcoff_ldsymsz */ LDRELSZ, /* _xcoff_ldrelsz */ 24, /* _xcoff_function_descriptor_size */ 0, /* _xcoff_small_aout_header_size */ - /* versions */ + + /* Versions. */ 2, /* _xcoff_ldhdr_version */ - /* xcoff vs xcoff64 putting symbol names */ + /* xcoff vs xcoff64 putting symbol names. */ _bfd_xcoff64_put_symbol_name, /* _xcoff_put_symbol_name */ _bfd_xcoff64_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */ - /* dynamic reloc howto */ + /* Dynamic reloc howto. */ &xcoff64_dynamic_reloc, xcoff64_create_csect_from_smclas, - /* lineno and reloc count overflow */ + /* Lineno and reloc count overflow. */ xcoff64_is_lineno_count_overflow, xcoff64_is_reloc_count_overflow, xcoff64_loader_symbol_offset, xcoff64_loader_reloc_offset, - /* glink */ + /* glink. */ &xcoff64_glink_code[0], 40, /* _xcoff_glink_size */ - /* rtinit */ + /* rtinit. */ 88, /* _xcoff_rtinit_size */ xcoff64_generate_rtinit, /* _xcoff_generate_rtinit */ }; -/* The transfer vector that leads the outside world to all of the above. */ +/* The transfer vector that leads the outside world to all of the above. */ const bfd_target rs6000coff64_vec = { "aixcoff64-rs6000", @@ -2718,3 +2731,256 @@ const bfd_target rs6000coff64_vec = /* back end data */ (void *) &bfd_xcoff_backend_data, }; + +extern const bfd_target * xcoff64_core_p PARAMS ((bfd *)); +extern boolean xcoff64_core_file_matches_executable_p PARAMS((bfd *, bfd *)); +extern char * xcoff64_core_file_failing_command PARAMS ((bfd *)); +extern int xcoff64_core_file_failing_signal PARAMS ((bfd *)); + +/* AIX 5 */ +static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data = +{ + { /* COFF backend, defined in libcoff.h. */ + _bfd_xcoff64_swap_aux_in, /* _bfd_coff_swap_aux_in */ + _bfd_xcoff64_swap_sym_in, /* _bfd_coff_swap_sym_in */ + _bfd_xcoff64_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ + _bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */ + _bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */ + _bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */ + coff_swap_reloc_out, /* _bfd_swap_reloc_out */ + coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ + coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ + coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ + FILHSZ, /* _bfd_filhsz */ + AOUTSZ, /* _bfd_aoutsz */ + SCNHSZ, /* _bfd_scnhsz */ + SYMESZ, /* _bfd_symesz */ + AUXESZ, /* _bfd_auxesz */ + RELSZ, /* _bfd_relsz */ + LINESZ, /* _bfd_linesz */ + FILNMLEN, /* _bfd_filnmlen */ + true, /* _bfd_coff_long_filenames */ + false, /* _bfd_coff_long_section_names */ + (3), /* _bfd_coff_default_section_alignment_power */ + true, /* _bfd_coff_force_symnames_in_strings */ + 4, /* _bfd_coff_debug_string_prefix_length */ + coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ + coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ + coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ + coff_swap_reloc_in, /* _bfd_reloc_in */ + xcoff64_bad_format_hook, /* _bfd_bad_format_hook */ + coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ + coff_mkobject_hook, /* _bfd_mkobject_hook */ + styp_to_sec_flags, /* _bfd_syp_to_sec_flags */ + coff_set_alignment_hook, /* _bfd_set_alignment_hook */ + coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ + symname_in_debug_hook, /* _coff_symname_in_debug_hook */ + coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */ + coff_print_aux, /* bfd_coff_print_aux */ + dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */ + dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */ + NULL, /* bfd_coff_sym_is_global */ + /* _bfd_coff_compute_section_file_positions */ + coff_compute_section_file_positions, + NULL , /* _bfd_coff_start_final_link */ + xcoff64_ppc_relocate_section, /* _bfd_coff_relocate_section */ + coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */ + NULL , /* _bfd_coff_addust_symndx */ + _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */ + coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */ + coff_final_link_postscript /* _bfd_coff_final_link_postscript */ + }, + + U64_TOCMAGIC, /* magic number */ + bfd_arch_powerpc, /* architecture */ + bfd_mach_ppc_620, /* machine */ + + /* Function pointers to xcoff specific swap routines. */ + xcoff64_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */ + xcoff64_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */ + xcoff64_swap_ldsym_in, /* _xcoff_swap_ldsym_in */ + xcoff64_swap_ldsym_out, /* _xcoff_swap_ldsym_out */ + xcoff64_swap_ldrel_in, /* _xcoff_swap_ldrel_in */ + xcoff64_swap_ldrel_out, /* _xcoff_swap_ldrel_out */ + + /* Sizes. */ + LDHDRSZ, /* _xcoff_ldhdrsz */ + LDSYMSZ, /* _xcoff_ldsymsz */ + LDRELSZ, /* _xcoff_ldrelsz */ + 24, /* _xcoff_function_descriptor_size */ + 0, /* _xcoff_small_aout_header_size */ + /* Versions. */ + 2, /* _xcoff_ldhdr_version */ + + _bfd_xcoff64_put_symbol_name, /* _xcoff_put_symbol_name */ + _bfd_xcoff64_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */ + + /* Dynamic reloc howto. */ + &xcoff64_dynamic_reloc, + xcoff64_create_csect_from_smclas, + + /* Lineno and reloc count overflow. */ + xcoff64_is_lineno_count_overflow, + xcoff64_is_reloc_count_overflow, + + xcoff64_loader_symbol_offset, + xcoff64_loader_reloc_offset, + + /* glink. */ + &xcoff64_glink_code[0], + 40, /* _xcoff_glink_size */ + + /* rtinit. */ + 88, /* _xcoff_rtinit_size */ + xcoff64_generate_rtinit, /* _xcoff_generate_rtinit */ +}; + +/* The transfer vector that leads the outside world to all of the above. */ +const bfd_target aix5coff64_vec = +{ + "aix5coff64-rs6000", + bfd_target_xcoff_flavour, + BFD_ENDIAN_BIG, /* data byte order is big */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | DYNAMIC | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* leading char */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen??? FIXMEmgo */ + + /* data */ + bfd_getb64, /* bfd_getx64 */ + bfd_getb_signed_64, /* bfd_getx_signed_64 */ + bfd_putb64, /* bfd_putx64 */ + bfd_getb32, /* bfd_getx32 */ + bfd_getb_signed_32, /* bfd_getx_signed_32 */ + bfd_putb32, /* bfd_putx32 */ + bfd_getb16, /* bfd_getx16 */ + bfd_getb_signed_16, /* bfd_getx_signed_16 */ + bfd_putb16, /* bfd_putx16 */ + + /* hdrs */ + bfd_getb64, /* bfd_h_getx64 */ + bfd_getb_signed_64, /* bfd_h_getx_signed_64 */ + bfd_putb64, /* bfd_h_putx64 */ + bfd_getb32, /* bfd_h_getx32 */ + bfd_getb_signed_32, /* bfd_h_getx_signed_32 */ + bfd_putb32, /* bfd_h_putx32 */ + bfd_getb16, /* bfd_h_getx16 */ + bfd_getb_signed_16, /* bfd_h_getx_signed_16 */ + bfd_putb16, /* bfd_h_putx16 */ + + { /* bfd_check_format */ + _bfd_dummy_target, + coff_object_p, + xcoff64_archive_p, + xcoff64_core_p + }, + + { /* bfd_set_format */ + bfd_false, + coff_mkobject, + _bfd_generic_mkarchive, + bfd_false + }, + + {/* bfd_write_contents */ + bfd_false, + xcoff64_write_object_contents, + _bfd_xcoff_write_archive_contents, + bfd_false + }, + + /* Generic */ + bfd_true, /* _close_and_cleanup */ + bfd_true, /* _bfd_free_cached_info */ + coff_new_section_hook, /* _new_section_hook */ + _bfd_generic_get_section_contents, /* _bfd_get_section_contents */ + /* _bfd_get_section_contents_in_window */ + _bfd_generic_get_section_contents_in_window, + + /* Copy */ + _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */ + /* _bfd_merge_private_bfd_data */ + ((boolean (*) (bfd *, bfd *)) bfd_true), + /* _bfd_copy_pivate_section_data */ + ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), + /* _bfd_copy_private_symbol_data */ + ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((boolean (*) (bfd *, flagword)) bfd_true), /* _bfd_set_private_flags */ + ((boolean (*) (bfd *, void * )) bfd_true), /* _bfd_print_private_bfd_data */ + + /* Core */ + xcoff64_core_file_failing_command, /* _core_file_failing_command */ + xcoff64_core_file_failing_signal, /* _core_file_failing_signal */ + xcoff64_core_file_matches_executable_p, /* _core_file_matches_executable_p */ + + /* Archive */ + xcoff64_slurp_armap, /* _slurp_armap */ + /* XCOFF archives do not have + anything which corresponds to + an extended name table. */ + bfd_false, /* _slurp_extended_name_table */ + /* _construct_extended_name_table */ + ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false), + bfd_dont_truncate_arname, /* _truncate_arname */ + _bfd_xcoff_write_armap, /* _write_armap */ + _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */ + xcoff64_openr_next_archived_file, /* _openr_next_archived_file */ + _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ + _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ + /* XCOFF archives do not have + a timestamp. */ + bfd_true, /* _update_armap_timestamp */ + + /* Symbols */ + coff_get_symtab_upper_bound, /* _get_symtab_upper_bound */ + coff_get_symtab, /* _get_symtab */ + coff_make_empty_symbol, /* _make_empty_symbol */ + coff_print_symbol, /* _print_symbol */ + coff_get_symbol_info, /* _get_symbol_info */ + _bfd_xcoff_is_local_label_name, /* _bfd_is_local_label_name */ + coff_get_lineno, /* _get_lineno */ + coff_find_nearest_line, /* _find_nearest_line */ + coff_bfd_make_debug_symbol, /* _bfd_make_debug_symbol */ + _bfd_generic_read_minisymbols, /* _read_minisymbols */ + _bfd_generic_minisymbol_to_symbol, /* _minsymbol_to_symbol */ + + /* Reloc */ + coff_get_reloc_upper_bound, /* _get_reloc_upper_bound */ + coff_canonicalize_reloc, /* _cononicalize_reloc */ + xcoff64_reloc_type_lookup, /* _bfd_reloc_type_lookup */ + + /* Write */ + coff_set_arch_mach, /* _set_arch_mach */ + coff_set_section_contents, /* _set_section_contents */ + + /* Link */ + xcoff64_sizeof_headers, /* _sizeof_headers */ + /* _bfd_get_relocated_section_contents */ + bfd_generic_get_relocated_section_contents, + bfd_generic_relax_section, /* _bfd_relax_section */ + _bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */ + _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */ + _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */ + _bfd_generic_link_split_section, /* _bfd_link_split_section */ + bfd_generic_gc_sections, /* _bfd_gc_sections */ + bfd_generic_merge_sections, /* _bfd_merge_sections */ + + /* Dynamic */ + /* _get_dynamic_symtab_upper_bound */ + _bfd_xcoff_get_dynamic_symtab_upper_bound, + _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */ + _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */ + _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */ + + /* Opposite endian version, none exists. */ + NULL, + + /* back end data */ + (void *) & bfd_xcoff_aix5_backend_data, +}; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index f87cb9e..db42987 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1493,12 +1493,12 @@ coff_new_section_hook (abfd, section) section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; #ifdef RS6000COFF_C - if (xcoff_data (abfd)->text_align_power != 0 + if (bfd_xcoff_text_align_power (abfd) != 0 && strcmp (bfd_get_section_name (abfd, section), ".text") == 0) - section->alignment_power = xcoff_data (abfd)->text_align_power; - if (xcoff_data (abfd)->data_align_power != 0 + section->alignment_power = bfd_xcoff_text_align_power (abfd); + if (bfd_xcoff_data_align_power (abfd) != 0 && strcmp (bfd_get_section_name (abfd, section), ".data") == 0) - section->alignment_power = xcoff_data (abfd)->data_align_power; + section->alignment_power = bfd_xcoff_data_align_power (abfd); #endif /* Allocate aux records for section symbols, to store size and @@ -1964,6 +1964,7 @@ coff_set_arch_mach_hook (abfd, filehdr) #ifdef RS6000COFF_C #ifdef XCOFF64 + case U64_TOCMAGIC: case U803XTOCMAGIC: #else case U802ROMAGIC: @@ -2768,14 +2769,8 @@ coff_set_flags (abfd, magicp, flagsp) #ifndef PPCMAGIC case bfd_arch_powerpc: #endif -#ifdef XCOFF64 - if (bfd_get_mach (abfd) == bfd_mach_ppc_620 - && !strncmp (abfd->xvec->name,"aix", 3)) - *magicp = U803XTOCMAGIC; - else -#else - *magicp = U802TOCMAGIC; -#endif + BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour); + *magicp = bfd_xcoff_magic_number (abfd); return true; break; #endif @@ -4447,7 +4442,7 @@ coff_slurp_symbol_table (abfd) if (src->u.syment.n_sclass == C_SECTION && src->u.syment.n_scnum > 0) - dst->symbol.flags = BSF_LOCAL; + dst->symbol.flags = BSF_LOCAL; #endif if (src->u.syment.n_sclass == C_WEAKEXT) dst->symbol.flags |= BSF_WEAK; diff --git a/bfd/config.bfd b/bfd/config.bfd index 58c7315..e0eb710 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -785,11 +785,22 @@ case "${targ}" in targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec" ;; + powerpc-*-aix5*) + targ_defvec=rs6000coff_vec + targ_selvecs="aix5coff64_vec" + want64=true + ;; + powerpc64-*-aix5*) + targ_defvec=aix5coff64_vec + targ_selvecs="rs6000coff_vec" + want64=true + ;; + powerpc-*-aix* | powerpc-*-beos* | rs6000-*-*) targ_defvec=rs6000coff_vec targ64_selvecs=rs6000coff64_vec case "${targ}" in - *-*-aix4.[3456789]* | *-*-aix[56789]*) + *-*-aix4.[3456789]* | *-*-aix[56789]*) want64=true;; *) diff --git a/bfd/configure b/bfd/configure index d211b21..3fba5e8 100755 --- a/bfd/configure +++ b/bfd/configure @@ -5156,8 +5156,11 @@ if test "${target}" = "${host}"; then COREFILE=trad-core.lo TRAD_HEADER='"hosts/m68kaux.h"' ;; - m88*-*-sysv4*) ;; - m88*-motorola-sysv*) COREFILE=ptrace-core.lo ;; + m88*-*-sysv4*) + ;; + m88*-motorola-sysv*) + COREFILE=ptrace-core.lo + ;; m88*-*-mach3*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/m88kmach3.h"' @@ -5169,7 +5172,13 @@ if test "${target}" = "${host}"; then ns32k-*-netbsd* | ns32k-*-openbsd*) COREFILE=netbsd-core.lo ;; - rs6000-*-lynx*) COREFILE=lynx-core.lo ;; + rs6000-*-lynx*) + COREFILE=lynx-core.lo + ;; + rs6000-*-aix5.* | powerpc-*-aix5.*) + COREFILE=rs6000-core.lo + COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE" + ;; rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*) COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE" @@ -5226,17 +5235,17 @@ if test "${target}" = "${host}"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5230: checking for $ac_hdr" >&5 +echo "configure:5239: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5235 "configure" +#line 5244 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5249: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5264,12 +5273,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5268: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5277: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5273 "configure" +#line 5282 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5278,7 +5287,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5300,12 +5309,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5304: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5313: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5309 "configure" +#line 5318 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5314,7 +5323,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5336,12 +5345,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5340: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5349: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5345 "configure" +#line 5354 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5350,7 +5359,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5372,12 +5381,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5376: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5385: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5381 "configure" +#line 5390 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5386,7 +5395,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5408,12 +5417,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5412: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5421: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5417 "configure" +#line 5426 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5422,7 +5431,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5444,12 +5453,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5448: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5457: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5453 "configure" +#line 5462 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5458,7 +5467,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5462: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5480,12 +5489,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5484: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5493: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5489 "configure" +#line 5498 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5494,7 +5503,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5507: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5516,12 +5525,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5520: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5529: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5525 "configure" +#line 5534 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5530,7 +5539,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5552,12 +5561,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5556: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5565: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5561 "configure" +#line 5570 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5566,7 +5575,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5588,12 +5597,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5592: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5601: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5597 "configure" +#line 5606 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5602,7 +5611,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5624,12 +5633,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5628: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5637: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5633 "configure" +#line 5642 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5638,7 +5647,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5660,12 +5669,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5664: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5673: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5669 "configure" +#line 5678 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5674,7 +5683,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5696,12 +5705,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5700: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5709: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5705 "configure" +#line 5714 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5710,7 +5719,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5732,12 +5741,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5736: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5745: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5741 "configure" +#line 5750 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5746,7 +5755,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:5750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5768,12 +5777,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5772: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5781: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5777 "configure" +#line 5786 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5782,7 +5791,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:5786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -5804,12 +5813,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5808: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5817: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5813 "configure" +#line 5822 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5818,7 +5827,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -5959,17 +5968,6 @@ do # This list is alphabetized to make it easy to compare # with the two vector lists in targets.c. For the same reason, # use one entry per line, even though this leads to long lines. - # FIXME: We include cofflink.lo not because it's needed for - # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec - # which needs it but does not list it. Should be fixed in right place. - bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" - target_size=64 ;; - bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" - target_size=64 ;; - bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" - target_size=64 ;; a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; @@ -6040,6 +6038,13 @@ do bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + # FIXME: We include cofflink.lo not because it's needed for + # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec + # which needs it but does not list it. Should be fixed in right place. + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; + bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; @@ -6132,7 +6137,8 @@ do pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; ppcboot_vec) tb="$tb ppcboot.lo" ;; riscix_vec) tb="$tb aout32.lo riscix.lo" ;; - rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;; + rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;; + aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;; rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;; shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; @@ -6235,10 +6241,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6239: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6245: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6242 "configure" +#line 6248 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6283,17 +6289,17 @@ for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6287: checking for $ac_hdr" >&5 +echo "configure:6293: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6292 "configure" +#line 6298 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6322,12 +6328,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6326: checking for $ac_func" >&5 +echo "configure:6332: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6331 "configure" +#line 6337 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6350,7 +6356,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6375,7 +6381,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6379: checking for working mmap" >&5 +echo "configure:6385: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6383,7 +6389,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6387 "configure" +#line 6393 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6536,7 +6542,7 @@ main() } EOF -if { (eval echo configure:6540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6561,12 +6567,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6565: checking for $ac_func" >&5 +echo "configure:6571: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6570 "configure" +#line 6576 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6589,7 +6595,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index a00ad5b..b48f540 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -308,8 +308,11 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/m68kaux.h"' ;; - m88*-*-sysv4*) ;; - m88*-motorola-sysv*) COREFILE=ptrace-core.lo ;; + m88*-*-sysv4*) + ;; + m88*-motorola-sysv*) + COREFILE=ptrace-core.lo + ;; m88*-*-mach3*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/m88kmach3.h"' @@ -321,7 +324,13 @@ changequote([,])dnl ns32k-*-netbsd* | ns32k-*-openbsd*) COREFILE=netbsd-core.lo ;; - rs6000-*-lynx*) COREFILE=lynx-core.lo ;; + rs6000-*-lynx*) + COREFILE=lynx-core.lo + ;; + rs6000-*-aix5.* | powerpc-*-aix5.*) + COREFILE=rs6000-core.lo + COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE" + ;; changequote(,)dnl rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*) changequote([,])dnl @@ -514,17 +523,6 @@ do # This list is alphabetized to make it easy to compare # with the two vector lists in targets.c. For the same reason, # use one entry per line, even though this leads to long lines. - # FIXME: We include cofflink.lo not because it's needed for - # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec - # which needs it but does not list it. Should be fixed in right place. - bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" - target_size=64 ;; - bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" - target_size=64 ;; - bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" - target_size=64 ;; a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; @@ -595,6 +593,13 @@ do bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; + # FIXME: We include cofflink.lo not because it's needed for + # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec + # which needs it but does not list it. Should be fixed in right place. + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; + bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; @@ -687,7 +692,8 @@ do pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; ppcboot_vec) tb="$tb ppcboot.lo" ;; riscix_vec) tb="$tb aout32.lo riscix.lo" ;; - rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;; + rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;; + aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;; rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;; shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index 0036c0b..698d76f 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -242,7 +242,7 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best all: all-redirect .SUFFIXES: diff --git a/bfd/libxcoff.h b/bfd/libxcoff.h index 20c3c4a..0cc23d3 100644 --- a/bfd/libxcoff.h +++ b/bfd/libxcoff.h @@ -1,22 +1,22 @@ /* BFD XCOFF object file private structure. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. Written by Tom Rix, Redhat. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -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 2 of the License, or -(at your option) any later version. + 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 2 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. + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef LIBXCOFF_H #define LIBXCOFF_H @@ -31,14 +31,14 @@ struct xcoff_backend_data_rec /* COFF backend information. */ bfd_coff_backend_data coff; - /* Magic number */ + /* Magic number. */ unsigned short _xcoff_magic_number; - /* Architecture and machine for coff_set_arch_mach_hook */ + /* Architecture and machine for coff_set_arch_mach_hook. */ enum bfd_architecture _xcoff_architecture; long _xcoff_machine; - /* function pointers to xcoff specific swap routines */ + /* Function pointers to xcoff specific swap routines. */ void (* _xcoff_swap_ldhdr_in)(bfd *, const PTR, struct internal_ldhdr *); void (* _xcoff_swap_ldhdr_out)(bfd *, const struct internal_ldhdr *, PTR); void (* _xcoff_swap_ldsym_in)(bfd *, const PTR, struct internal_ldsym *); @@ -46,33 +46,34 @@ struct xcoff_backend_data_rec void (* _xcoff_swap_ldrel_in)(bfd *, const PTR, struct internal_ldrel *); void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, PTR); - /* size of the external struct */ + /* Size of the external struct. */ unsigned int _xcoff_ldhdrsz; unsigned int _xcoff_ldsymsz; unsigned int _xcoff_ldrelsz; - /* size an entry in a descriptor section */ + /* Size an entry in a descriptor section. */ unsigned int _xcoff_function_descriptor_size; - /* size of the small aout file header */ + /* Size of the small aout file header. */ unsigned int _xcoff_small_aout_header_size; /* Loader version 1 : XCOFF32 - 2 : XCOFF64 */ + 2 : XCOFF64. */ unsigned long _xcoff_ldhdr_version; - boolean (* _xcoff_put_symbol_name)(bfd *, struct bfd_strtab_hash *, - struct internal_syment *, - const char *); + boolean (* _xcoff_put_symbol_name) + PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *, + const char *)); - boolean (* _xcoff_put_ldsymbol_name)(bfd *, struct xcoff_loader_info *, - struct internal_ldsym *, - const char *); + boolean (* _xcoff_put_ldsymbol_name) + PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *, + const char *)); reloc_howto_type *_xcoff_dynamic_reloc; - asection * (* _xcoff_create_csect_from_smclas) (bfd *, union internal_auxent *, const char *); + asection * (* _xcoff_create_csect_from_smclas) + PARAMS ((bfd *, union internal_auxent *, const char *)); /* Line number and relocation overflow. XCOFF32 overflows to another section when the line number or the @@ -82,7 +83,7 @@ struct xcoff_backend_data_rec /* Loader section symbol and relocation table offset XCOFF32 is after the .loader header - XCOFF64 is offset in .loader header */ + XCOFF64 is offset in .loader header. */ bfd_vma (*_xcoff_loader_symbol_offset)(bfd *, struct internal_ldhdr *); bfd_vma (*_xcoff_loader_reloc_offset)(bfd *, struct internal_ldhdr *); @@ -93,21 +94,19 @@ struct xcoff_backend_data_rec /* Size of the global link code in bytes of the xcoff_glink_code table. */ unsigned long _xcoff_glink_size; - /* rtinit */ + /* rtinit. */ unsigned int _xcoff_rtinit_size; boolean (*_xcoff_generate_rtinit)(bfd *, const char *, const char *, boolean); }; /* Look up an entry in an XCOFF link hash table. */ - #define xcoff_link_hash_lookup(table, string, create, copy, follow) \ ((struct xcoff_link_hash_entry *) \ bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\ (follow))) /* Traverse an XCOFF link hash table. */ - #define xcoff_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ @@ -116,7 +115,6 @@ struct xcoff_backend_data_rec /* Get the XCOFF link hash table from the info structure. This is just a cast. */ - #define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash)) @@ -186,8 +184,11 @@ struct xcoff_backend_data_rec #define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)])) #define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size)) -/* Check for the magic number U803XTOCMAGIC for 64 bit targets. */ -#define bfd_xcoff_is_xcoff64(a) (0x01EF == (bfd_xcoff_magic_number(a))) +/* Check for the magic number U803XTOCMAGIC or U64_TOCMAGIC for 64 bit + targets. */ +#define bfd_xcoff_is_xcoff64(a) \ + ( (0x01EF == (bfd_xcoff_magic_number(a))) \ + || (0x01F7 == (bfd_xcoff_magic_number(a)))) /* Check for the magic number U802TOMAGIC for 32 bit targets. */ #define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a))) @@ -195,4 +196,8 @@ struct xcoff_backend_data_rec #define bfd_xcoff_rtinit_size(a) ((xcoff_backend(a)->_xcoff_rtinit_size)) #define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c), (d)))) +/* Accessor macros for tdata. */ +#define bfd_xcoff_text_align_power(a) ((xcoff_data (a)->text_align_power)) +#define bfd_xcoff_data_align_power(a) ((xcoff_data (a)->data_align_power)) + #endif /* LIBXCOFF_H */ diff --git a/bfd/reloc.c b/bfd/reloc.c index 559a351..c701fe0 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2051,106 +2051,6 @@ ENUMX BFD_RELOC_MIPS_JALR COMMENT COMMENT -ENUMX - BFD_RELOC_SH_GOT_LOW16 -ENUMX - BFD_RELOC_SH_GOT_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOT_MEDHI16 -ENUMX - BFD_RELOC_SH_GOT_HI16 -ENUMX - BFD_RELOC_SH_GOTPLT_LOW16 -ENUMX - BFD_RELOC_SH_GOTPLT_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOTPLT_MEDHI16 -ENUMX - BFD_RELOC_SH_GOTPLT_HI16 -ENUMX - BFD_RELOC_SH_PLT_LOW16 -ENUMX - BFD_RELOC_SH_PLT_MEDLOW16 -ENUMX - BFD_RELOC_SH_PLT_MEDHI16 -ENUMX - BFD_RELOC_SH_PLT_HI16 -ENUMX - BFD_RELOC_SH_GOTOFF_LOW16 -ENUMX - BFD_RELOC_SH_GOTOFF_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOTOFF_MEDHI16 -ENUMX - BFD_RELOC_SH_GOTOFF_HI16 -ENUMX - BFD_RELOC_SH_GOTPC_LOW16 -ENUMX - BFD_RELOC_SH_GOTPC_MEDLOW16 -ENUMX - BFD_RELOC_SH_GOTPC_MEDHI16 -ENUMX - BFD_RELOC_SH_GOTPC_HI16 -ENUMX - BFD_RELOC_SH_COPY64 -ENUMX - BFD_RELOC_SH_GLOB_DAT64 -ENUMX - BFD_RELOC_SH_JMP_SLOT64 -ENUMX - BFD_RELOC_SH_RELATIVE64 -ENUMX - BFD_RELOC_SH_GOT10BY4 -ENUMX - BFD_RELOC_SH_GOT10BY8 -ENUMX - BFD_RELOC_SH_GOTPLT10BY4 -ENUMX - BFD_RELOC_SH_GOTPLT10BY8 -ENUMX - BFD_RELOC_SH_GOTPLT32 -COMMENT -ENUMX - BFD_RELOC_SH_SHMEDIA_CODE -ENUMX - BFD_RELOC_SH_IMMU5 -ENUMX - BFD_RELOC_SH_IMMS6 -ENUMX - BFD_RELOC_SH_IMMS6BY32 -ENUMX - BFD_RELOC_SH_IMMU6 -ENUMX - BFD_RELOC_SH_IMMS10 -ENUMX - BFD_RELOC_SH_IMMS10BY2 -ENUMX - BFD_RELOC_SH_IMMS10BY4 -ENUMX - BFD_RELOC_SH_IMMS10BY8 -ENUMX - BFD_RELOC_SH_IMMS16 -ENUMX - BFD_RELOC_SH_IMMU16 -ENUMX - BFD_RELOC_SH_IMM_LOW16 -ENUMX - BFD_RELOC_SH_IMM_LOW16_PCREL -ENUMX - BFD_RELOC_SH_IMM_MEDLOW16 -ENUMX - BFD_RELOC_SH_IMM_MEDLOW16_PCREL -ENUMX - BFD_RELOC_SH_IMM_MEDHI16 -ENUMX - BFD_RELOC_SH_IMM_MEDHI16_PCREL -ENUMX - BFD_RELOC_SH_IMM_HI16 -ENUMX - BFD_RELOC_SH_IMM_HI16_PCREL -ENUMX - BFD_RELOC_SH_PT_16 -COMMENT ENUMDOC MIPS ELF relocations. @@ -2487,6 +2387,104 @@ ENUMX BFD_RELOC_SH_RELATIVE ENUMX BFD_RELOC_SH_GOTPC +ENUMX + BFD_RELOC_SH_GOT_LOW16 +ENUMX + BFD_RELOC_SH_GOT_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOT_MEDHI16 +ENUMX + BFD_RELOC_SH_GOT_HI16 +ENUMX + BFD_RELOC_SH_GOTPLT_LOW16 +ENUMX + BFD_RELOC_SH_GOTPLT_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTPLT_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTPLT_HI16 +ENUMX + BFD_RELOC_SH_PLT_LOW16 +ENUMX + BFD_RELOC_SH_PLT_MEDLOW16 +ENUMX + BFD_RELOC_SH_PLT_MEDHI16 +ENUMX + BFD_RELOC_SH_PLT_HI16 +ENUMX + BFD_RELOC_SH_GOTOFF_LOW16 +ENUMX + BFD_RELOC_SH_GOTOFF_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTOFF_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTOFF_HI16 +ENUMX + BFD_RELOC_SH_GOTPC_LOW16 +ENUMX + BFD_RELOC_SH_GOTPC_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTPC_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTPC_HI16 +ENUMX + BFD_RELOC_SH_COPY64 +ENUMX + BFD_RELOC_SH_GLOB_DAT64 +ENUMX + BFD_RELOC_SH_JMP_SLOT64 +ENUMX + BFD_RELOC_SH_RELATIVE64 +ENUMX + BFD_RELOC_SH_GOT10BY4 +ENUMX + BFD_RELOC_SH_GOT10BY8 +ENUMX + BFD_RELOC_SH_GOTPLT10BY4 +ENUMX + BFD_RELOC_SH_GOTPLT10BY8 +ENUMX + BFD_RELOC_SH_GOTPLT32 +ENUMX + BFD_RELOC_SH_SHMEDIA_CODE +ENUMX + BFD_RELOC_SH_IMMU5 +ENUMX + BFD_RELOC_SH_IMMS6 +ENUMX + BFD_RELOC_SH_IMMS6BY32 +ENUMX + BFD_RELOC_SH_IMMU6 +ENUMX + BFD_RELOC_SH_IMMS10 +ENUMX + BFD_RELOC_SH_IMMS10BY2 +ENUMX + BFD_RELOC_SH_IMMS10BY4 +ENUMX + BFD_RELOC_SH_IMMS10BY8 +ENUMX + BFD_RELOC_SH_IMMS16 +ENUMX + BFD_RELOC_SH_IMMU16 +ENUMX + BFD_RELOC_SH_IMM_LOW16 +ENUMX + BFD_RELOC_SH_IMM_LOW16_PCREL +ENUMX + BFD_RELOC_SH_IMM_MEDLOW16 +ENUMX + BFD_RELOC_SH_IMM_MEDLOW16_PCREL +ENUMX + BFD_RELOC_SH_IMM_MEDHI16 +ENUMX + BFD_RELOC_SH_IMM_MEDHI16_PCREL +ENUMX + BFD_RELOC_SH_IMM_HI16 +ENUMX + BFD_RELOC_SH_IMM_HI16_PCREL +ENUMX + BFD_RELOC_SH_PT_16 ENUMDOC Hitachi SH relocs. Not all of these appear in object files. diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c index 19ff4a4..0edcdc4 100644 --- a/bfd/rs6000-core.c +++ b/bfd/rs6000-core.c @@ -11,21 +11,21 @@ Archive support from Damon A. Permezel. Contributed by IBM Corporation and Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -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 2 of the License, or -(at your option) any later version. + 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 2 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. + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This port currently only handles reading object files, except when compiled on an RS/6000 host. -- no archive support, no core files. diff --git a/bfd/targets.c b/bfd/targets.c index 78b4bbb..2ff69d6 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -631,6 +631,7 @@ extern const bfd_target ppcboot_vec; extern const bfd_target riscix_vec; extern const bfd_target rs6000coff64_vec; extern const bfd_target rs6000coff_vec; +extern const bfd_target aix5coff64_vec; extern const bfd_target shcoff_small_vec; extern const bfd_target shcoff_vec; extern const bfd_target shlcoff_small_vec; diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 5b1ddcc..b817426 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -3,21 +3,21 @@ Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -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 2 of the License, or -(at your option) any later version. + 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 2 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. + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -3141,37 +3141,42 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, csectpp = xcoff_data (sub)->csects; - symesz = bfd_coff_symesz (sub); - esym = (bfd_byte *) obj_coff_external_syms (sub); - esymend = esym + symcount * symesz; - while (esym < esymend) + /* Dynamic object do not have csectpp's. */ + if (NULL != csectpp) { - struct internal_syment sym; + symesz = bfd_coff_symesz (sub); + esym = (bfd_byte *) obj_coff_external_syms (sub); + esymend = esym + symcount * symesz; - bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym); + while (esym < esymend) + { + struct internal_syment sym; - *debug_index = (unsigned long) -1; + bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym); - if (sym._n._n_n._n_zeroes == 0 - && *csectpp != NULL - && (! gc - || ((*csectpp)->flags & SEC_MARK) != 0 - || *csectpp == bfd_abs_section_ptr) - && bfd_coff_symname_in_debug (sub, &sym)) - { - char *name; - bfd_size_type indx; + *debug_index = (unsigned long) -1; - name = (char *) debug_contents + sym._n._n_n._n_offset; - indx = _bfd_stringtab_add (debug_strtab, name, true, true); - if (indx == (bfd_size_type) -1) - goto error_return; - *debug_index = indx; - } + if (sym._n._n_n._n_zeroes == 0 + && *csectpp != NULL + && (! gc + || ((*csectpp)->flags & SEC_MARK) != 0 + || *csectpp == bfd_abs_section_ptr) + && bfd_coff_symname_in_debug (sub, &sym)) + { + char *name; + bfd_size_type indx; - esym += (sym.n_numaux + 1) * symesz; - csectpp += sym.n_numaux + 1; - debug_index += sym.n_numaux + 1; + name = (char *) debug_contents + sym._n._n_n._n_offset; + indx = _bfd_stringtab_add (debug_strtab, name, true, true); + if (indx == (bfd_size_type) -1) + goto error_return; + *debug_index = indx; + } + + esym += (sym.n_numaux + 1) * symesz; + csectpp += sym.n_numaux + 1; + debug_index += sym.n_numaux + 1; + } } free (debug_contents); |