This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
big patch, Aix 5, binutils emulation, aix 64 bit shared library.
- From: Tom Rix <trix at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 14 Mar 2002 18:02:25 -0600
- Subject: big patch, Aix 5, binutils emulation, aix 64 bit shared library.
This patch has 3 major parts.
1. AIX 5.1
2. 64 bit AIX shared libraries.
3. binutils emulation layer.
Aix 5.1
New magic number for 64 bit objects. New 64 bit core file. So a new
vector aix5coff64_vec and various ripples through the tools.
64 bit Aix shared libraries
64 bit shared objects need to aligned within the archive to the
alignment. This is the o_algntext field in the auxiliary header.
IMO shared objects/libraries work. So I'll fix them if they don't :)~
Binutils emulation layer.
I was not happy with the way ar did some things like picking the target
for the objects or parsing the command line. Do you really want aix's
-X32_64 option as part of the a x86, sparc, mips ar? I am also
interested in extend the AIX options on ar and other binutils without
seeming like a hack.
When in doubt use another layer of indirection
I am proposing to separate the target specific parts of binutils to an
emulation layer. binemul.c defines the binutils emulation layer which
are wrappers around function pointers contained in a target specific
emulation vector. binemul.c defines the default functions pointers, a
cut-n-paste from ar. The vector is define in binemul.h. The vector
determined in the configuration. _Everyone_ but aix 4.3 and 5 is
bin_vanilla_emulation. The vectors are defined in the file
emul_<target_emul>.c
The format for the function pointers is <tool name>_emul_<target's
option>_<action>. So for an example the aix function to parse print out
aix specific usage is ar_emul_aix_usage.
ar.c has been modified to use emulation layer.
The -X32_64 support has been moved to aix emulation. There is a start
of support to the aix -X32 -X64 and -g options.
The emulation layer has been checked against sparc,x86 linux & aix.
Comments?
Tom
--
Tom Rix
GCC Engineer
trix@redhat.com
bfd :
2002-03-14 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.
binutils:
+ 2002-03-14 Tom Rix <trix@redhat.com>
* Makefile.am: Add binutils emulation support.
* configure.in: Same.
* configure.tgt: New file. Same.
* ar.c (main): Use ar_emul_parse_arg.
(usage): Use ar_emul_usage.
(replace_members): Use ar_emul_replace, ar_emul_append.
* binemul.c: New file. Define the binutils emulation
layer. Define default methods.
* binemul.h: New file. Binutils emulation layer header file.
* emul_aix.c: New file. AIX binutils emulation.
* emul_vanilla.c: New file. Default binutils emulation.
* Makefile.in: Regenerate.
* configure: Same.
gas:
2002-03-14 Tom Rix <trix@redhat.com>
* configure.in: Add AIX 5 support.
* config/tc-ppc.c (ppc_target_format): Add AIX 5 64 bit target.
* config/te-aix5.h: New file. AIX 5 support.
* configure: Regenerate.
include/coff:
2002-03-14 Tom Rix <trix@redhat.com>
* rs6k64.h: Add U64_TOCMAGIC, AIX 5 64 bit magic number.
ld:
2002-03-14 Tom Rix <trix@redhat.com>
* Makefile.am : Add eaix5ppc and eaix5rs6, AIX 5 support.
* configure.tgt : Same.
* emulparms/aix5ppc.sh : New file. For eaix5ppc.
* emulparms/aix5rs6.sh : New file. For eaix5rs6.
* emulparms/aixppc.sh : OUPUT_FORMAT_32BIT and OUTPUT_FORMAT_64BIT
emulation parameters for better -b32, -b64 support.
* emulparms/aixrs6.sh : Same.
* emulparms/ppcmacos.sh : Same.
* emultempl/aix.em (choose_target) : Use new emulation parameters
OUTPUT_FORMAT_32BIT and OUTPUT_FORMAT_64BIT.
* Makefile.in : Regenerate.
diff -rcp -N src-old/bfd/Makefile.am src-dev/bfd/Makefile.am
*** src-old/bfd/Makefile.am Mon Mar 4 11:28:11 2002
--- src-dev/bfd/Makefile.am Thu Mar 14 10:17:00 2002
*************** BFD32_BACKENDS = \
*** 289,295 ****
vms-hdr.lo \
vms-misc.lo \
vms-tir.lo \
! xcofflink.lo
BFD32_BACKENDS_CFILES = \
aout-adobe.c \
--- 289,295 ----
vms-hdr.lo \
vms-misc.lo \
vms-tir.lo \
! xcofflink.lo
BFD32_BACKENDS_CFILES = \
aout-adobe.c \
*************** BFD32_BACKENDS_CFILES = \
*** 441,446 ****
--- 441,447 ----
# 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 \
*************** BFD64_BACKENDS = \
*** 464,469 ****
--- 465,471 ----
pepigen.lo
BFD64_BACKENDS_CFILES = \
+ aix5ppc-core.c \
aout64.c \
coff-alpha.c \
coff64-rs6000.c \
*************** coff-alpha.lo: coff-alpha.c $(INCDIR)/fi
*** 1374,1379 ****
--- 1376,1383 ----
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
libcoff.h libecoff.h coffswap.h ecoffswap.h
+ aix5ppc-core.lo: aix5ppc-core.c $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/xcoff.h libcoff.h libxcoff.h
coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
$(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \
diff -rcp -N src-old/bfd/aix5ppc-core.c src-dev/bfd/aix5ppc-core.c
*** src-old/bfd/aix5ppc-core.c Wed Dec 31 18:00:00 1969
--- src-dev/bfd/aix5ppc-core.c Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,375 ----
+ /* 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))
+ goto xcoff64_core_p_truncate_error;
+
+ new_core_hdr = (struct core_dumpxx *)
+ bfd_zalloc (abfd, sizeof(struct core_dumpxx));
+ if (NULL == new_core_hdr)
+ goto xcoff64_core_p_end;
+
+ 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)
+ goto xcoff64_core_p_end;
+
+ 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)
+ goto xcoff64_core_p_end;
+
+ 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)
+ goto xcoff64_core_p_end;
+
+ 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)
+ goto xcoff64_core_p_end;
+
+ 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)
+ goto xcoff64_core_p_end;
+
+ if (sizeof (struct __ld_info64) !=
+ bfd_read (&ldinfo, sizeof(struct __ld_info64), 1, abfd))
+ goto xcoff64_core_p_end;
+
+ if (ldinfo.ldinfo_core)
+ {
+
+ sec = bfd_make_section_anyway (abfd, ".data");
+ if (NULL == sec)
+ goto xcoff64_core_p_end;
+
+ 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)
+ goto xcoff64_core_p_end;
+
+ for (i = 0; i < core.c_vmregions; i++)
+ if (sizeof (struct vm_infox) !=
+ bfd_read (&vminfo, sizeof (struct vm_infox), 1, abfd))
+ goto xcoff64_core_p_end;
+
+ if (vminfo.vminfo_offset)
+ {
+ sec = bfd_make_section_anyway (abfd, ".vmdata");
+ if (NULL == sec)
+ goto xcoff64_core_p_end;
+
+ 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_end:
+
+ return return_value;
+
+ xcoff64_core_p_error :
+
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+
+ goto xcoff64_core_p_end;
+
+ xcoff64_core_p_truncate_error:
+
+ bfd_set_error (bfd_error_file_truncated);
+
+ goto xcoff64_core_p_end;
+ }
+
+ /* 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)
+ goto xcoff64_core_file_matches_executable_p_end;
+
+ if (sizeof (struct core_dumpxx) !=
+ bfd_read (&core, sizeof (struct core_dumpxx), 1, core_bfd))
+ goto xcoff64_core_file_matches_executable_p_end;
+
+ if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0)
+ goto xcoff64_core_file_matches_executable_p_end;
+
+ alloc = 100;
+ path = bfd_malloc (alloc);
+ if (path == NULL)
+ goto xcoff64_core_file_matches_executable_p_end;
+
+ 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);
+
+ xcoff64_core_file_matches_executable_p_end:
+
+ 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 -rcp -N src-old/bfd/bfd-in.h src-dev/bfd/bfd-in.h
*** src-old/bfd/bfd-in.h Mon Mar 4 11:28:11 2002
--- src-dev/bfd/bfd-in.h Thu Mar 14 10:17:00 2002
*************** extern boolean bfd_xcoff_size_dynamic_se
*** 749,754 ****
--- 749,757 ----
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 -rcp -N src-old/bfd/coff-rs6000.c src-dev/bfd/coff-rs6000.c
*** src-old/bfd/coff-rs6000.c Mon Mar 4 11:28:12 2002
--- src-dev/bfd/coff-rs6000.c Thu Mar 14 10:17:00 2002
*************** static bfd_vma xcoff_loader_reloc_offset
*** 145,150 ****
--- 145,154 ----
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. */
*************** _bfd_xcoff_reloc_type_lookup (abfd, code
*** 989,994 ****
--- 993,1008 ----
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. */
*************** static char buff20[XCOFFARMAGBIG_ELEMENT
*** 1573,1578 ****
--- 1587,1685 ----
(v) = bfd_scan_vma (buff20, (const char **) NULL, 10)
static boolean
+ do_pad (abfd, number)
+ bfd *abfd;
+ unsigned int number;
+ {
+ boolean return_value = false;
+ bfd_byte b = 0;
+
+ /* Limit pad to <= 4096 */
+ if (number > 4096)
+ goto do_pad_end;
+
+ while (number--)
+ if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+ return false;
+
+ return_value = true;
+
+ do_pad_end:
+ return return_value;
+ }
+
+ static boolean
+ do_copy (out_bfd, in_bfd)
+ bfd *out_bfd;
+ bfd *in_bfd;
+ {
+ boolean return_value = false;
+ bfd_size_type remaining;
+ bfd_byte buffer[DEFAULT_BUFFERSIZE];
+
+ if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0)
+ goto do_copy_end;
+
+ remaining = arelt_size (in_bfd);
+
+ while (remaining >= DEFAULT_BUFFERSIZE)
+ {
+ if (DEFAULT_BUFFERSIZE !=
+ bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) ||
+ DEFAULT_BUFFERSIZE !=
+ bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd))
+ goto do_copy_end;
+ remaining -= DEFAULT_BUFFERSIZE;
+ }
+
+ if (remaining)
+ {
+ if (remaining != bfd_bread (buffer, remaining, in_bfd) ||
+ remaining != bfd_bwrite (buffer, remaining, out_bfd))
+ goto do_copy_end;
+ }
+
+ return_value = true;
+
+ do_copy_end:
+ return return_value;
+ }
+
+ 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;
+ {
+ boolean return_value = false;
+
+ 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 (false == do_pad (out_bfd, pad))
+ goto do_shared_object_padding_end;
+
+ *offset += pad;
+ }
+
+ return_value = true;
+ do_shared_object_padding_end:
+ return return_value;
+
+ }
+
+ static boolean
xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength ATTRIBUTE_UNUSED;
*************** xcoff_write_archive_contents_old (abfd)
*** 2001,2028 ****
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;
! }
}
sprintf (fhdr.lastmemoff, "%ld", (long) prevoff);
--- 2108,2119 ----
if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0)
return false;
! if (false == do_copy (abfd, sub))
! return false;
!
! if (false == do_pad (abfd, size & 1))
! return false;
}
sprintf (fhdr.lastmemoff, "%ld", (long) prevoff);
*************** xcoff_write_archive_contents_old (abfd)
*** 2089,2102 ****
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;
! }
/* Write out the armap, if appropriate. */
if (! makemap || ! hasobjects)
--- 2180,2188 ----
if (bfd_bwrite ((PTR) name, namlen + 1, abfd) != namlen + 1)
return false;
}
! if (false == do_pad (abfd, size & 1))
! return false;
/* Write out the armap, if appropriate. */
if (! makemap || ! hasobjects)
*************** xcoff_write_archive_contents_big (abfd)
*** 2143,2157 ****
bfd_byte *member_table, *mt;
bfd_vma member_table_size;
memcpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
- PRINT20 (fhdr.firstmemoff, SIZEOF_AR_FILE_HDR_BIG);
- PRINT20 (fhdr.freeoff, 0);
/* Calculate count and total_namlen */
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;
offsets = NULL;
if (count)
--- 2229,2254 ----
bfd_byte *member_table, *mt;
bfd_vma member_table_size;
+ memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG);
memcpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
+ 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;
! if (makemap && ! hasobjects)
! {
! if (bfd_check_format (current_bfd, bfd_object))
! hasobjects = true;
! }
! }
offsets = NULL;
if (count)
*************** xcoff_write_archive_contents_big (abfd)
*** 2160,2170 ****
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;
--- 2257,2263 ----
*************** xcoff_write_archive_contents_big (abfd)
*** 2176,2187 ****
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);
--- 2269,2274 ----
*************** xcoff_write_archive_contents_big (abfd)
*** 2236,2241 ****
--- 2323,2336 ----
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 (false == do_shared_object_padding (abfd, current_bfd, &nextoff,
+ SIZEOF_AR_HDR_BIG + namlen
+ + SXCOFFARFMAG))
+ return false;
+
offsets[i] = nextoff;
prevoff = nextoff;
*************** xcoff_write_archive_contents_big (abfd)
*** 2252,2282 ****
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;
! }
}
! PRINT20 (fhdr.lastmemoff, prevoff);
/* Write out the member table.
Layout :
--- 2347,2365 ----
if (bfd_seek (current_bfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
! if (false == do_copy (abfd, current_bfd))
! return false;
!
! if (false == do_pad (abfd, size & 1))
! return false;
}
! if (count)
! {
! PRINT20 (fhdr.firstmemoff, offsets[0]);
! PRINT20 (fhdr.lastmemoff, prevoff);
! }
/* Write out the member table.
Layout :
*************** static const struct xcoff_backend_data_r
*** 3457,3468 ****
/* Versions. */
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 */
!
xcoff_create_csect_from_smclas, /* _xcoff_create_csect_from_smclas */
/* Lineno and reloc count overflow. */
--- 3540,3548 ----
/* Versions. */
1, /* _xcoff_ldhdr_version */
_bfd_xcoff_put_symbol_name, /* _xcoff_put_symbol_name */
_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. */
diff -rcp -N src-old/bfd/coff64-rs6000.c src-dev/bfd/coff64-rs6000.c
*** src-old/bfd/coff64-rs6000.c Mon Mar 4 11:28:12 2002
--- src-dev/bfd/coff64-rs6000.c Thu Mar 14 10:17:00 2002
*************** static bfd_vma xcoff64_loader_symbol_off
*** 144,150 ****
static bfd_vma xcoff64_loader_reloc_offset
PARAMS ((bfd *, struct internal_ldhdr *));
static boolean xcoff64_generate_rtinit
! PARAMS((bfd *, const char *, const char *, boolean));
/* coffcode.h needs these to be defined */
/* Internalcoff.h and coffcode.h modify themselves based on these flags. */
--- 144,151 ----
static bfd_vma xcoff64_loader_reloc_offset
PARAMS ((bfd *, struct internal_ldhdr *));
static boolean xcoff64_generate_rtinit
! PARAMS ((bfd *, const char *, const char *, boolean));
! static boolean xcoff64_bad_format_hook PARAMS ((bfd *, PTR ));
/* coffcode.h needs these to be defined */
/* Internalcoff.h and coffcode.h modify themselves based on these flags. */
*************** xcoff64_write_object_contents (abfd)
*** 805,815 ****
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_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC :
(abfd->flags & WP_TEXT) ? RS6K_AOUTHDR_NMAGIC :
RS6K_AOUTHDR_OMAGIC;
--- 806,812 ----
memset (&internal_a, 0, sizeof internal_a);
! 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;
*************** xcoff64_loader_reloc_offset (abfd, ldhdr
*** 2114,2119 ****
--- 2111,2133 ----
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;
*************** static const struct xcoff_backend_data_r
*** 2499,2505 ****
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 */
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 */
--- 2513,2519 ----
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 */
*************** const bfd_target rs6000coff64_vec =
*** 2717,2720 ****
--- 2731,2988 ----
/* 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 -rcp -N src-old/bfd/coffcode.h src-dev/bfd/coffcode.h
*** src-old/bfd/coffcode.h Mon Mar 4 11:28:12 2002
--- src-dev/bfd/coffcode.h Thu Mar 14 10:17:00 2002
***************
*** 1,6 ****
/* Support for the generic parts of most COFF variants, for BFD.
! Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
! 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
--- 1,5 ----
/* Support for the generic parts of most COFF variants, for BFD.
! Copyright 1990 - 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
*************** coff_new_section_hook (abfd, section)
*** 1493,1504 ****
section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
#ifdef RS6000COFF_C
! if (xcoff_data (abfd)->text_align_power != 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
&& strcmp (bfd_get_section_name (abfd, section), ".data") == 0)
! section->alignment_power = xcoff_data (abfd)->data_align_power;
#endif
/* Allocate aux records for section symbols, to store size and
--- 1492,1503 ----
section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
#ifdef RS6000COFF_C
! if (bfd_xcoff_text_align_power (abfd) != 0
&& strcmp (bfd_get_section_name (abfd, section), ".text") == 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 = bfd_xcoff_data_align_power (abfd);
#endif
/* Allocate aux records for section symbols, to store size and
*************** coff_set_arch_mach_hook (abfd, filehdr)
*** 1964,1969 ****
--- 1963,1969 ----
#ifdef RS6000COFF_C
#ifdef XCOFF64
+ case U64_TOCMAGIC:
case U803XTOCMAGIC:
#else
case U802ROMAGIC:
*************** coff_set_flags (abfd, magicp, flagsp)
*** 2768,2781 ****
#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
return true;
break;
#endif
--- 2768,2775 ----
#ifndef PPCMAGIC
case bfd_arch_powerpc:
#endif
! BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
! *magicp = bfd_xcoff_magic_number(abfd);
return true;
break;
#endif
diff -rcp -N src-old/bfd/config.bfd src-dev/bfd/config.bfd
*** src-old/bfd/config.bfd Mon Mar 4 11:28:12 2002
--- src-dev/bfd/config.bfd Thu Mar 14 10:17:00 2002
*************** case "${targ}" in
*** 785,795 ****
targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
;;
powerpc-*-aix* | powerpc-*-beos* | rs6000-*-*)
targ_defvec=rs6000coff_vec
targ64_selvecs=rs6000coff64_vec
case "${targ}" in
! *-*-aix4.[3456789]* | *-*-aix[56789]*)
want64=true;;
*)
--- 785,806 ----
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]*)
want64=true;;
*)
diff -rcp -N src-old/bfd/configure.in src-dev/bfd/configure.in
*** src-old/bfd/configure.in Mon Mar 4 11:28:12 2002
--- src-dev/bfd/configure.in Thu Mar 14 10:17:00 2002
*************** changequote([,])dnl
*** 323,328 ****
--- 323,332 ----
;;
rs6000-*-lynx*) COREFILE=lynx-core.lo ;;
changequote(,)dnl
+ 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]*)
changequote([,])dnl
COREFILE=rs6000-core.lo
*************** do
*** 687,693 ****
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 ;;
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" ;;
--- 691,698 ----
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 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 -rcp -N src-old/bfd/libxcoff.h src-dev/bfd/libxcoff.h
*** src-old/bfd/libxcoff.h Mon Mar 4 11:28:17 2002
--- src-dev/bfd/libxcoff.h Thu Mar 14 10:17:00 2002
*************** struct xcoff_backend_data_rec
*** 186,193 ****
#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 U802TOMAGIC for 32 bit targets. */
#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a)))
--- 186,196 ----
#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 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)))
*************** struct xcoff_backend_data_rec
*** 195,198 ****
--- 198,204 ----
#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 -rcp -N src-old/bfd/rs6000-core.c src-dev/bfd/rs6000-core.c
*** src-old/bfd/rs6000-core.c Mon Mar 4 11:28:18 2002
--- src-dev/bfd/rs6000-core.c Thu Mar 14 10:17:00 2002
***************
*** 1,6 ****
/* IBM RS/6000 "XCOFF" back-end for BFD.
! Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
! 2001, 2002
Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
--- 1,5 ----
/* IBM RS/6000 "XCOFF" back-end for BFD.
! Copyright 1990 - 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
diff -rcp -N src-old/bfd/targets.c src-dev/bfd/targets.c
*** src-old/bfd/targets.c Mon Mar 4 11:28:19 2002
--- src-dev/bfd/targets.c Thu Mar 14 10:17:00 2002
*************** extern const bfd_target ppcboot_vec;
*** 631,636 ****
--- 631,637 ----
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 -rcp -N src-old/bfd/xcofflink.c src-dev/bfd/xcofflink.c
*** src-old/bfd/xcofflink.c Mon Mar 4 11:28:19 2002
--- src-dev/bfd/xcofflink.c Thu Mar 14 10:17:00 2002
*************** bfd_xcoff_size_dynamic_sections (output_
*** 3141,3177 ****
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)
{
! struct internal_syment sym;
!
! bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym);
!
! *debug_index = (unsigned long) -1;
!
! 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;
! 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);
--- 3141,3181 ----
csectpp = xcoff_data (sub)->csects;
! /* Dynamic object do not have csectpp's */
! if (NULL != csectpp)
{
! symesz = bfd_coff_symesz (sub);
! esym = (bfd_byte *) obj_coff_external_syms (sub);
! esymend = esym + symcount * symesz;
! while (esym < esymend)
{
! struct internal_syment sym;
!
! bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym);
!
! *debug_index = (unsigned long) -1;
!
! 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;
!
! 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);
diff -rcp -N src-old/binutils/Makefile.am src-dev/binutils/Makefile.am
*** src-old/binutils/Makefile.am Mon Mar 4 11:28:03 2002
--- src-dev/binutils/Makefile.am Thu Mar 14 10:17:00 2002
*************** INCDIR = $(BASEDIR)/include
*** 71,80 ****
MKDEP = gcc -MM
! INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
! windres.h winduni.h
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
--- 71,81 ----
MKDEP = gcc -MM
! INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\"" \
! -Dbin_dummy_emulation=$(EMULATION_VECTOR)
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
! windres.h winduni.h binemul.h
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
*************** CFILES = addr2line.c ar.c arsup.c bucomm
*** 84,90 ****
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
stabs.c strings.c sysdump.c version.c wrstabs.c \
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
! resres.c dllwrap.c rename.c
GENERATED_CFILES = \
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
--- 85,91 ----
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
stabs.c strings.c sysdump.c version.c wrstabs.c \
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
! resres.c dllwrap.c rename.c binemul.c emul_$(EMULATION).c
GENERATED_CFILES = \
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
*************** cplus-dem.o: $(BASEDIR)/libiberty/cplus-
*** 183,192 ****
cxxfilt_SOURCES =
cxxfilt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
! ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c $(BULIBS)
ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
! ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c $(BULIBS)
ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
addr2line_SOURCES = addr2line.c $(BULIBS)
--- 184,195 ----
cxxfilt_SOURCES =
cxxfilt_LDADD = cplus-dem.o underscore.o $(LIBIBERTY) $(INTLLIBS)
! ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \
! emul_$(EMULATION).c $(BULIBS)
ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
! ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c \
! binemul.c emul_$(EMULATION).c $(BULIBS)
ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
addr2line_SOURCES = addr2line.c $(BULIBS)
diff -rcp -N src-old/binutils/ar.c src-dev/binutils/ar.c
*** src-old/binutils/ar.c Mon Mar 4 11:28:03 2002
--- src-dev/binutils/ar.c Thu Mar 14 10:17:00 2002
*************** Foundation, Inc., 59 Temple Place - Suit
*** 34,39 ****
--- 34,40 ----
#include "libbfd.h"
#include "arsup.h"
#include "filenames.h"
+ #include "binemul.h"
#include <sys/stat.h>
#ifdef __GO32___
*************** usage (help)
*** 251,257 ****
if (! is_ranlib)
{
/* xgettext:c-format */
! fprintf (s, _("Usage: %s [-X32_64] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"),
program_name);
/* xgettext:c-format */
fprintf (s, _(" %s -M [<mri-script]\n"), program_name);
--- 252,258 ----
if (! is_ranlib)
{
/* xgettext:c-format */
! fprintf (s, _("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"),
program_name);
/* xgettext:c-format */
fprintf (s, _(" %s -M [<mri-script]\n"), program_name);
*************** usage (help)
*** 277,283 ****
fprintf (s, _(" [S] - do not build a symbol table\n"));
fprintf (s, _(" [v] - be verbose\n"));
fprintf (s, _(" [V] - display the version number\n"));
! fprintf (s, _(" [-X32_64] - (ignored)\n"));
}
else
{
--- 278,285 ----
fprintf (s, _(" [S] - do not build a symbol table\n"));
fprintf (s, _(" [v] - be verbose\n"));
fprintf (s, _(" [V] - display the version number\n"));
!
! ar_emul_usage (s);
}
else
{
*************** main (argc, argv)
*** 383,388 ****
--- 385,391 ----
int file_count;
char *inarch_filename;
int show_version;
+ int i;
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
*************** main (argc, argv)
*** 444,460 ****
xatexit (remove_output);
! /* Ignored for (partial) AIX compatibility. On AIX,
! the -X option can be used to ignore certain kinds
! of object files in the archive (the 64-bit objects
! or the 32-bit objects). GNU ar always looks at all
! kinds of objects in an archive. */
! while (argc > 1 && strcmp (argv[1], "-X32_64") == 0)
! {
! argv++;
! argc--;
! }
!
if (is_ranlib)
{
boolean touch = false;
--- 447,458 ----
xatexit (remove_output);
! for (i = 1; i < argc; i++)
! if (false == ar_emul_parse_arg (argv[i]))
! break;
! argv += (i - 1);
! argc -= (i - 1);
!
if (is_ranlib)
{
boolean touch = false;
*************** main (argc, argv)
*** 587,593 ****
default:
/* xgettext:c-format */
non_fatal (_("illegal option -- %c"), c);
- usage (0);
}
}
--- 585,590 ----
*************** replace_members (arch, files_to_move, qu
*** 1341,1365 ****
after_bfd = get_pos_bfd (&arch->next, pos_after,
current->filename);
- temp = *after_bfd;
! *after_bfd = bfd_openr (*files_to_move, NULL);
! if (*after_bfd == (bfd *) NULL)
! {
! bfd_fatal (*files_to_move);
! }
! (*after_bfd)->next = temp;
!
! /* snip out this entry from the chain */
! *current_ptr = (*current_ptr)->next;
!
! if (verbose)
{
! printf ("r - %s\n", *files_to_move);
}
!
! changed = true;
!
goto next_file;
}
current_ptr = &(current->next);
--- 1338,1352 ----
after_bfd = get_pos_bfd (&arch->next, pos_after,
current->filename);
! if (true == ar_emul_replace (after_bfd, *files_to_move,
! verbose))
{
! /* snip out this entry from the chain */
! *current_ptr = (*current_ptr)->next;
! changed = true;
}
!
goto next_file;
}
current_ptr = &(current->next);
*************** replace_members (arch, files_to_move, qu
*** 1367,1388 ****
}
/* Add to the end of the archive. */
-
after_bfd = get_pos_bfd (&arch->next, pos_end, NULL);
! temp = *after_bfd;
! *after_bfd = bfd_openr (*files_to_move, NULL);
! if (*after_bfd == (bfd *) NULL)
! {
! bfd_fatal (*files_to_move);
! }
! if (verbose)
! {
! printf ("a - %s\n", *files_to_move);
! }
!
! (*after_bfd)->next = temp;
!
! changed = true;
next_file:;
--- 1354,1362 ----
}
/* Add to the end of the archive. */
after_bfd = get_pos_bfd (&arch->next, pos_end, NULL);
! if (true == ar_emul_append (after_bfd, *files_to_move, verbose))
! changed = true;
next_file:;
diff -rcp -N src-old/binutils/binemul.c src-dev/binutils/binemul.c
*** src-old/binutils/binemul.c Wed Dec 31 18:00:00 1969
--- src-dev/binutils/binemul.c Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,164 ----
+ /* Binutils emulation layer.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Written by Tom Rix, Redhat.
+
+ This file is part of GNU Binutils.
+
+ 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 "binemul.h"
+
+ extern bin_emulation_xfer_type bin_dummy_emulation;
+
+ void
+ ar_emul_usage (fp)
+ FILE *fp;
+ {
+ if (bin_dummy_emulation.ar_usage)
+ bin_dummy_emulation.ar_usage (fp);
+ }
+
+ void
+ ar_emul_default_usage (fp)
+ FILE *fp;
+ {
+ AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp);
+ /* xgettext:c-format */
+ fprintf (fp, _(" No emulation specific options\n"));
+ }
+
+ boolean
+ ar_emul_append (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ if (bin_dummy_emulation.ar_append)
+ return bin_dummy_emulation.ar_append (after_bfd, file_name, verbose);
+
+ return false;
+ }
+
+ boolean
+ ar_emul_default_append (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ bfd *temp;
+
+ temp = *after_bfd;
+ *after_bfd = bfd_openr (file_name, NULL);
+
+ AR_EMUL_ELEMENT_CHECK (*after_bfd, file_name);
+ AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name);
+
+ (*after_bfd)->next = temp;
+
+ return true;
+ }
+
+ boolean
+ ar_emul_replace (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ if (bin_dummy_emulation.ar_replace)
+ return bin_dummy_emulation.ar_replace (after_bfd, file_name, verbose);
+
+ return false;
+ }
+
+ boolean
+ ar_emul_default_replace (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ bfd *temp;
+
+ temp = *after_bfd;
+ *after_bfd = bfd_openr (file_name, NULL);
+
+ AR_EMUL_ELEMENT_CHECK (*after_bfd, file_name);
+ AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
+
+ (*after_bfd)->next = temp;
+
+ return true;
+ }
+
+ boolean
+ ar_emul_create (abfd_out, archive_file_name, file_name)
+ bfd **abfd_out;
+ char *archive_file_name;
+ char *file_name;
+ {
+ if (bin_dummy_emulation.ar_create)
+ return bin_dummy_emulation.ar_create (abfd_out, archive_file_name,
+ file_name);
+
+ return false;
+ }
+
+ boolean
+ ar_emul_default_create (abfd_out, archive_file_name, file_name)
+ bfd **abfd_out;
+ char *archive_file_name;
+ char *file_name;
+ {
+ char *target = NULL;
+
+ /* Try to figure out the target to use for the archive from the
+ first object on the list. */
+ if (file_name != NULL)
+ {
+ bfd *obj;
+
+ obj = bfd_openr (file_name, NULL);
+ if (obj != NULL)
+ {
+ if (bfd_check_format (obj, bfd_object))
+ target = bfd_get_target (obj);
+ (void) bfd_close (obj);
+ }
+ }
+
+ /* Create an empty archive. */
+ *abfd_out = bfd_openw (archive_file_name, target);
+ if (*abfd_out == NULL
+ || ! bfd_set_format (*abfd_out, bfd_archive)
+ || ! bfd_close (*abfd_out))
+ bfd_fatal (archive_file_name);
+
+ return true;
+ }
+
+ boolean ar_emul_parse_arg (arg)
+ char *arg;
+ {
+ if (bin_dummy_emulation.ar_parse_arg)
+ return bin_dummy_emulation.ar_parse_arg (arg);
+
+ return false;
+ }
+
+ boolean ar_emul_default_parse_arg (arg)
+ char *arg;
+ {
+ return false;
+ }
+
diff -rcp -N src-old/binutils/binemul.h src-dev/binutils/binemul.h
*** src-old/binutils/binemul.h Wed Dec 31 18:00:00 1969
--- src-dev/binutils/binemul.h Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,69 ----
+ /* Binutils emulation layer.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Written by Tom Rix, Redhat.
+
+ This file is part of GNU Binutils.
+
+ 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. */
+
+ #ifndef BINEMUL_H
+ #define BINEMUL_H
+
+ #include "bfd.h"
+ #include "bucomm.h"
+
+ extern void ar_emul_usage PARAMS ((FILE *));
+ extern void ar_emul_default_usage PARAMS ((FILE *));
+ extern boolean ar_emul_append PARAMS ((bfd **, char *, boolean));
+ extern boolean ar_emul_default_append PARAMS ((bfd **, char *, boolean));
+ extern boolean ar_emul_replace PARAMS ((bfd **, char *, boolean));
+ extern boolean ar_emul_default_replace PARAMS ((bfd **, char *, boolean));
+ extern boolean ar_emul_create PARAMS ((bfd **, char *, char *));
+ extern boolean ar_emul_default_create PARAMS ((bfd **, char *, char *));
+ extern boolean ar_emul_parse_arg PARAMS ((char *));
+ extern boolean ar_emul_default_parse_arg PARAMS ((char *));
+
+ /* Macros for common output */
+
+ #define AR_EMUL_USAGE_PRINT_OPTION_HEADER(fp) \
+ /* xgettext:c-format */ \
+ fprintf (fp, _(" emulation options: \n"))
+
+ #define AR_EMUL_ELEMENT_CHECK(abfd, file_name) \
+ do { if ((abfd) == (bfd *) NULL) bfd_fatal (file_name); } while (0)
+
+ #define AR_EMUL_APPEND_PRINT_VERBOSE(verbose, file_name) \
+ do { if (verbose) printf ("a - %s\n", file_name); } while (0)
+
+ #define AR_EMUL_REPLACE_PRINT_VERBOSE(verbose, file_name) \
+ do { if (verbose) printf ("r - %s\n", file_name); } while (0)
+
+ typedef struct bin_emulation_xfer_struct
+ {
+ /* Print out the extra options */
+ void (*ar_usage) PARAMS ((FILE *fp));
+ boolean (*ar_append) PARAMS ((bfd **after_bfd, char *file_name,
+ boolean verbose));
+ boolean (*ar_replace) PARAMS ((bfd **after_bfd, char *file_name,
+ boolean verbose));
+ boolean (*ar_create) PARAMS ((bfd **abfd_out, char *file_name,
+ char *target));
+ boolean (*ar_parse_arg) PARAMS ((char *arg));
+ } bin_emulation_xfer_type;
+
+
+ #endif
+
+
diff -rcp -N src-old/binutils/configure.in src-dev/binutils/configure.in
*** src-old/binutils/configure.in Mon Mar 4 11:28:03 2002
--- src-dev/binutils/configure.in Thu Mar 14 10:17:00 2002
*************** else
*** 313,318 ****
--- 313,339 ----
fi
AC_SUBST(UNDERSCORE)
+ # Emulation
+ for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
+ do
+ # Canonicalize the secondary target names.
+ result=`$ac_config_sub $targ_alias 2>/dev/null`
+ if test -n "$result"; then
+ targ=$result
+ else
+ targ=$targ_alias
+ fi
+
+ . ${srcdir}/configure.tgt
+
+ EMULATION=$targ_emul
+ EMULATION_VECTOR=$targ_emul_vector
+ done
+
+ AC_SUBST(EMULATION)
+ AC_SUBST(EMULATION_VECTOR)
+
+
AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in,
[
case "x$CONFIG_FILES" in
diff -rcp -N src-old/binutils/configure.tgt src-dev/binutils/configure.tgt
*** src-old/binutils/configure.tgt Wed Dec 31 18:00:00 1969
--- src-dev/binutils/configure.tgt Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,25 ----
+ # This is the binutils target specific file. This is invoked by the
+ # autoconf generated configure script. Putting it in a separate shell
+ # file lets us skip running autoconf when modifying target specific
+ # information.
+
+ # This file switches on the shell variable ${targ}, and sets the
+ # following shell variables:
+ # targ_emul name of emulation to use
+ # targ_emul_vector name of vector to use
+
+ case "${targ}" in
+ powerpc-*-aix5* | rs6000-*-aix5* )
+ targ_emul=aix
+ targ_emul_vector=bin_aix5_emulation
+ ;;
+
+ powerpc-*-aix4.3* | rs6000-*-aix4.3* )
+ targ_emul=aix
+ targ_emul_vector=bin_aix_emulation
+ ;;
+
+ *) targ_emul=vanilla
+ targ_emul_vector=bin_vanilla_emulation
+ ;;
+ esac
diff -rcp -N src-old/binutils/emul_aix.c src-dev/binutils/emul_aix.c
*** src-old/binutils/emul_aix.c Wed Dec 31 18:00:00 1969
--- src-dev/binutils/emul_aix.c Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,289 ----
+ /* Binutils emulation layer.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Written by Tom Rix, Redhat.
+
+ This file is part of GNU Binutils.
+
+ 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 "binemul.h"
+ #include "bfdlink.h"
+ #include "coff/internal.h"
+ #include "coff/xcoff.h"
+ #include "libcoff.h"
+ #include "libxcoff.h"
+
+ /* Default to <bigaf> */
+ static boolean big_archive = true;
+
+ /* Whether to include 32 bit objects. */
+ static boolean X32 = true;
+
+ /* Whether to include 64 bit objects. */
+ static boolean X64 = false;
+
+ static void ar_emul_aix_usage PARAMS ((FILE *));
+ static boolean ar_emul_aix_append PARAMS ((bfd **, char *, boolean));
+ static boolean ar_emul_aix5_append PARAMS ((bfd **, char *, boolean));
+ static boolean ar_emul_aix_replace PARAMS ((bfd **, char *, boolean));
+ static boolean ar_emul_aix5_replace PARAMS ((bfd **, char *, boolean));
+ static boolean ar_emul_aix_parse_arg PARAMS((char *arg));
+
+ static void
+ ar_emul_aix_usage (fp)
+ FILE *fp;
+ {
+ AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp);
+ /* xgettext:c-format */
+ fprintf (fp, _(" [-g] - 32 bit small archive\n"));
+ fprintf (fp, _(" [-X32] - ignores 64 bit objects\n"));
+ fprintf (fp, _(" [-X64] - ignores 32 bit objects\n"));
+ fprintf (fp, _(" [-X32_64] - accepts 32 and 64 bit objects\n"));
+ }
+
+ static boolean
+ ar_emul_aix_append (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ boolean return_value = false;
+
+ bfd *temp;
+ bfd *try_bfd;
+
+ temp = *after_bfd;
+
+ /* Try 64 bit */
+ try_bfd = bfd_openr (file_name, "aixcoff64-rs6000");
+
+ /* Failed or the object is possibly 32 bit */
+ if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object))
+ try_bfd = bfd_openr (file_name, "aixcoff-rs6000");
+
+ AR_EMUL_ELEMENT_CHECK (try_bfd, file_name);
+
+ if (bfd_xcoff_is_xcoff64 (try_bfd) && false == X64)
+ goto ar_emul_aix_append_end;
+
+ if (bfd_xcoff_is_xcoff32 (try_bfd)
+ && bfd_check_format (try_bfd, bfd_object) && false == X32)
+ goto ar_emul_aix_append_end;
+
+ AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name);
+ *after_bfd = try_bfd;
+ (*after_bfd)->next = temp;
+
+ return_value = true;
+ ar_emul_aix_append_end:
+ return return_value;
+ }
+
+
+ static boolean
+ ar_emul_aix5_append (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ boolean return_value = false;
+
+ bfd *temp;
+ bfd *try_bfd;
+
+ temp = *after_bfd;
+
+ /* Try 64 bit */
+ try_bfd = bfd_openr (file_name, "aix5coff64-rs6000");
+
+ /* Failed or the object is possibly 32 bit */
+ if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object))
+ try_bfd = bfd_openr (file_name, "aixcoff-rs6000");
+
+ AR_EMUL_ELEMENT_CHECK (try_bfd, file_name);
+
+ if (bfd_xcoff_is_xcoff64 (try_bfd) && false == X64)
+ goto ar_emul_aix5_append_end;
+
+ if (bfd_xcoff_is_xcoff32 (try_bfd)
+ && bfd_check_format (try_bfd, bfd_object) && false == X32)
+ goto ar_emul_aix5_append_end;
+
+ AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name);
+ *after_bfd = try_bfd;
+ (*after_bfd)->next = temp;
+
+ return_value = true;
+ ar_emul_aix5_append_end:
+ return return_value;
+ }
+
+ static boolean
+ ar_emul_aix_replace (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ boolean return_value = false;
+
+ bfd *temp;
+ bfd *try_bfd;
+
+ temp = *after_bfd;
+
+ /* Try 64 bit */
+ try_bfd = bfd_openr (file_name, "aixcoff64-rs6000");
+
+ /* Failed or the object is possibly 32 bit */
+ if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object))
+ try_bfd = bfd_openr (file_name, "aixcoff-rs6000");
+
+ AR_EMUL_ELEMENT_CHECK (try_bfd, file_name);
+
+ if (bfd_xcoff_is_xcoff64 (try_bfd) && false == X64)
+ goto ar_emul_aix_replace_end;
+
+ if (bfd_xcoff_is_xcoff32 (try_bfd)
+ && bfd_check_format (try_bfd, bfd_object) && false == X32)
+ goto ar_emul_aix_replace_end;
+
+ AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
+ *after_bfd = try_bfd;
+ (*after_bfd)->next = temp;
+
+ return_value = true;
+ ar_emul_aix_replace_end:
+ return return_value;
+ }
+
+
+ static boolean
+ ar_emul_aix5_replace (after_bfd, file_name, verbose)
+ bfd **after_bfd;
+ char *file_name;
+ boolean verbose;
+ {
+ boolean return_value = false;
+
+ bfd *temp;
+ bfd *try_bfd;
+
+ temp = *after_bfd;
+
+ /* Try 64 bit */
+ try_bfd = bfd_openr (file_name, "aix5coff64-rs6000");
+
+ /* Failed or the object is possibly 32 bit */
+ if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object))
+ try_bfd = bfd_openr (file_name, "aixcoff-rs6000");
+
+ AR_EMUL_ELEMENT_CHECK (try_bfd, file_name);
+
+ if (bfd_xcoff_is_xcoff64 (try_bfd) && false == X64)
+ goto ar_emul_aix5_replace_end;
+
+ if (bfd_xcoff_is_xcoff32 (try_bfd)
+ && bfd_check_format (try_bfd, bfd_object) && false == X32)
+ goto ar_emul_aix5_replace_end;
+
+ AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
+ *after_bfd = try_bfd;
+ (*after_bfd)->next = temp;
+
+ return_value = true;
+ ar_emul_aix5_replace_end:
+ return return_value;
+ }
+
+ boolean
+ ar_emul_aix_create (abfd_out, archive_file_name, file_name)
+ bfd **abfd_out;
+ char *archive_file_name;
+ char *file_name ATTRIBUTE_UNUSED;
+ {
+ char *target = "aixcoff-rs6000";
+
+ /* Create an empty archive. */
+ *abfd_out = bfd_openw (archive_file_name, target);
+
+ if (*abfd_out == NULL)
+ bfd_fatal (archive_file_name);
+
+ /* set to small or big format */
+ /* not done */
+
+ return true;
+ }
+
+
+ static boolean
+ ar_emul_aix_parse_arg (arg)
+ char *arg;
+ {
+ boolean return_value = false;
+
+ if (0 == strncmp (arg, "-X32_64", 6))
+ {
+ big_archive = true;
+ X32 = true;
+ X64 = true;
+ }
+ else if (0 == strncmp (arg, "-X32", 3))
+ {
+ big_archive = true;
+ X32 = true;
+ X64 = false;
+ }
+ else if (0 == strncmp (arg, "-X64", 3))
+ {
+ big_archive = true;
+ X32 = false;
+ X64 = true;
+ }
+ else if (0 == strncmp (arg, "-g", 2))
+ {
+ big_archive = false;
+ X32 = true;
+ X64 = false;
+ }
+ else
+ {
+ goto ar_emul_aix_parse_arg_end;
+ }
+
+ return_value = true;
+
+ ar_emul_aix_parse_arg_end:
+ return return_value;
+ }
+
+ struct bin_emulation_xfer_struct bin_aix_emulation =
+ {
+ ar_emul_aix_usage,
+ ar_emul_aix_append,
+ ar_emul_aix_replace,
+ ar_emul_default_create,
+ ar_emul_aix_parse_arg,
+ };
+
+ struct bin_emulation_xfer_struct bin_aix5_emulation =
+ {
+ ar_emul_aix_usage,
+ ar_emul_aix5_append,
+ ar_emul_aix5_replace,
+ ar_emul_default_create,
+ ar_emul_aix_parse_arg,
+ };
+
diff -rcp -N src-old/binutils/emul_vanilla.c src-dev/binutils/emul_vanilla.c
*** src-old/binutils/emul_vanilla.c Wed Dec 31 18:00:00 1969
--- src-dev/binutils/emul_vanilla.c Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,31 ----
+ /* Binutils emulation layer.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Written by Tom Rix, Redhat.
+
+ This file is part of GNU Binutils.
+
+ 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 "binemul.h"
+
+ struct bin_emulation_xfer_struct bin_vanilla_emulation =
+ {
+ ar_emul_default_usage,
+ ar_emul_default_append,
+ ar_emul_default_replace,
+ ar_emul_default_create,
+ ar_emul_default_parse_arg,
+ };
+
diff -rcp -N src-old/gas/config/tc-ppc.c src-dev/gas/config/tc-ppc.c
*** src-old/gas/config/tc-ppc.c Mon Mar 4 11:28:34 2002
--- src-dev/gas/config/tc-ppc.c Thu Mar 14 10:17:00 2002
*************** ppc_target_format ()
*** 1137,1143 ****
#elif TE_POWERMAC
return "xcoff-powermac";
#else
! return ppc_xcoff64 ? "aixcoff64-rs6000" : "aixcoff-rs6000";
#endif
#endif
#ifdef OBJ_ELF
--- 1137,1147 ----
#elif TE_POWERMAC
return "xcoff-powermac";
#else
! #ifdef TE_AIX5
! return (ppc_xcoff64 ? "aix5coff64-rs6000" : "aixcoff-rs6000");
! #else
! return (ppc_xcoff64 ? "aixcoff64-rs6000" : "aixcoff-rs6000");
! #endif
#endif
#endif
#ifdef OBJ_ELF
diff -rcp -N src-old/gas/config/te-aix5.h src-dev/gas/config/te-aix5.h
*** src-old/gas/config/te-aix5.h Wed Dec 31 18:00:00 1969
--- src-dev/gas/config/te-aix5.h Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,3 ----
+ #define TE_AIX5
+
+ #include "obj-format.h"
diff -rcp -N src-old/gas/configure.in src-dev/gas/configure.in
*** src-old/gas/configure.in Mon Mar 4 11:28:39 2002
--- src-dev/gas/configure.in Thu Mar 14 10:17:00 2002
*************** changequote([,])dnl
*** 384,389 ****
--- 384,390 ----
pj*) fmt=elf ;;
ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
fmt=coff em=pe ;;
+ ppc-*-aix5*) fmt=coff em=aix5 ;;
ppc-*-aix*) fmt=coff ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
diff -rcp -N src-old/include/coff/rs6k64.h src-dev/include/coff/rs6k64.h
*** src-old/include/coff/rs6k64.h Mon Mar 4 11:28:22 2002
--- src-dev/include/coff/rs6k64.h Thu Mar 14 10:17:00 2002
***************
*** 1,5 ****
/* IBM RS/6000 "XCOFF64" file definitions for BFD.
! Copyright (C) 2000 Free Software Foundation, Inc.
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
--- 1,5 ----
/* IBM RS/6000 "XCOFF64" file definitions for BFD.
! Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
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
*************** struct external_filehdr {
*** 28,37 ****
char f_nsyms[4]; /* number of symtab entries */
};
! /* IBM RS/6000 */
! #define U803XTOCMAGIC 0757 /* readonly text segments and TOC, XCOFF64 */
!
! #define BADMAG(x) ((x).f_magic != U803XTOCMAGIC)
#define FILHDR struct external_filehdr
#define FILHSZ 24
--- 28,37 ----
char f_nsyms[4]; /* number of symtab entries */
};
! /* IBM RS/6000 */
! #define U803XTOCMAGIC 0757 /* Aix 4.3 64-bit XCOFF */
! #define U64_TOCMAGIC 0767 /* AIX 5+ 64-bit XCOFF */
! #define BADMAG(x) ((x).f_magic != U803XTOCMAGIC && (x).f_magic != U64_TOCMAGIC)
#define FILHDR struct external_filehdr
#define FILHSZ 24
diff -rcp -N src-old/ld/Makefile.am src-dev/ld/Makefile.am
*** src-old/ld/Makefile.am Mon Mar 4 11:29:13 2002
--- src-dev/ld/Makefile.am Thu Mar 14 10:17:00 2002
*************** GEN_DEPENDS = $(srcdir)/genscripts.sh st
*** 353,358 ****
--- 353,364 ----
ea29k.c: $(srcdir)/emulparams/a29k.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
${GENSCRIPTS} a29k "$(tdir_a29k)"
+ eaix5ppc.c: $(srcdir)/emulparams/aix5ppc.sh \
+ $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} aix5ppc "$(tdir_aixppc)"
+ eaix5rs6.c: $(srcdir)/emulparams/aix5rs6.sh \
+ $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} aix5rs6 "$(tdir_aixrs6)"
eaixppc.c: $(srcdir)/emulparams/aixppc.sh \
$(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
${GENSCRIPTS} aixppc "$(tdir_aixppc)"
diff -rcp -N src-old/ld/configure.tgt src-dev/ld/configure.tgt
*** src-old/ld/configure.tgt Mon Mar 4 11:29:13 2002
--- src-dev/ld/configure.tgt Thu Mar 14 10:17:00 2002
*************** powerpc-*-netware*) targ_emul=ppcnw ;;
*** 420,427 ****
--- 420,429 ----
powerpcle-*-pe) targ_emul=ppcpe ;;
powerpcle-*-winnt*) targ_emul=ppcpe ;;
powerpcle-*-cygwin*) targ_emul=ppcpe ;;
+ powerpc-*-aix5*) targ_emul=aix5ppc ;;
powerpc-*-aix*) targ_emul=aixppc ;;
powerpc-*-beos*) targ_emul=aixppc ;;
+ rs6000-*-aix5*) targ_emul=aix5rs6 ;;
rs6000-*-aix*) targ_emul=aixrs6 ;;
tic30-*-*aout*) targ_emul=tic30aout ;;
tic30-*-*coff*) targ_emul=tic30coff ;;
diff -rcp -N src-old/ld/emulparams/aix5ppc.sh src-dev/ld/emulparams/aix5ppc.sh
*** src-old/ld/emulparams/aix5ppc.sh Wed Dec 31 18:00:00 1969
--- src-dev/ld/emulparams/aix5ppc.sh Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,7 ----
+ TEMPLATE_NAME=aix
+ SCRIPT_NAME=aix
+ OUTPUT_FORMAT="aixcoff-rs6000"
+ OUTPUT_FORMAT_32BIT="aixcoff-rs6000"
+ OUTPUT_FORMAT_64BIT="aix5coff64-rs6000"
+ ARCH=powerpc
+
diff -rcp -N src-old/ld/emulparams/aix5rs6.sh src-dev/ld/emulparams/aix5rs6.sh
*** src-old/ld/emulparams/aix5rs6.sh Wed Dec 31 18:00:00 1969
--- src-dev/ld/emulparams/aix5rs6.sh Thu Mar 14 10:17:00 2002
***************
*** 0 ****
--- 1,7 ----
+ TEMPLATE_NAME=aix
+ SCRIPT_NAME=aix
+ OUTPUT_FORMAT="aixcoff-rs6000"
+ OUTPUT_FORMAT_32BIT="aixcoff-rs6000"
+ OUTPUT_FORMAT_64BIT="aix5coff64-rs6000"
+ ARCH=rs6000
+
diff -rcp -N src-old/ld/emulparams/aixppc.sh src-dev/ld/emulparams/aixppc.sh
*** src-old/ld/emulparams/aixppc.sh Mon Mar 4 11:29:13 2002
--- src-dev/ld/emulparams/aixppc.sh Thu Mar 14 10:17:00 2002
***************
*** 1,5 ****
--- 1,7 ----
TEMPLATE_NAME=aix
SCRIPT_NAME=aix
OUTPUT_FORMAT="aixcoff-rs6000"
+ OUTPUT_FORMAT_32BIT="aixcoff-rs6000"
+ OUTPUT_FORMAT_64BIT="aixcoff64-rs6000"
ARCH=powerpc
diff -rcp -N src-old/ld/emulparams/aixrs6.sh src-dev/ld/emulparams/aixrs6.sh
*** src-old/ld/emulparams/aixrs6.sh Mon Mar 4 11:29:13 2002
--- src-dev/ld/emulparams/aixrs6.sh Thu Mar 14 10:17:00 2002
***************
*** 1,5 ****
--- 1,7 ----
TEMPLATE_NAME=aix
SCRIPT_NAME=aix
OUTPUT_FORMAT="aixcoff-rs6000"
+ OUTPUT_FORMAT_32BIT="aixcoff-rs6000"
+ OUTPUT_FORMAT_64BIT="aixcoff64-rs6000"
ARCH=rs6000
diff -rcp -N src-old/ld/emulparams/ppcmacos.sh src-dev/ld/emulparams/ppcmacos.sh
*** src-old/ld/emulparams/ppcmacos.sh Mon Mar 4 11:29:13 2002
--- src-dev/ld/emulparams/ppcmacos.sh Thu Mar 14 10:17:00 2002
***************
*** 1,4 ****
--- 1,6 ----
TEMPLATE_NAME=aix
SCRIPT_NAME=aix
OUTPUT_FORMAT="xcoff-powermac"
+ OUTPUT_FORMAT_32BIT="xcoff-powermac"
+ OUTPUT_FORMAT_64BIT="xcoff-powermac"
ARCH=powerpc
diff -rcp -N src-old/ld/emultempl/aix.em src-dev/ld/emultempl/aix.em
*** src-old/ld/emultempl/aix.em Mon Mar 4 11:29:15 2002
--- src-dev/ld/emultempl/aix.em Thu Mar 14 10:17:00 2002
*************** choose_target (argc, argv)
*** 797,804 ****
static char *from_inside;
static char *argv_to_target[][2] = {
{NULL, "${OUTPUT_FORMAT}"},
! {"-b32", "aixcoff-rs6000"},
! {"-b64", "aixcoff64-rs6000"},
};
jmax = 3;
--- 797,804 ----
static char *from_inside;
static char *argv_to_target[][2] = {
{NULL, "${OUTPUT_FORMAT}"},
! {"-b32", "${OUTPUT_FORMAT_32BIT}"},
! {"-b64", "${OUTPUT_FORMAT_64BIT}"},
};
jmax = 3;