aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-31 18:17:12 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-31 18:17:12 +0000
commitd19df9b51f33394c53d221f559cda4606e25a04b (patch)
tree878ccd7a3d4d7977b799eddac120dc712c0a27dd
parentc31c8827c8eb639a0c6efb9ca716a10b4d6d14f0 (diff)
downloadgdb-d19df9b51f33394c53d221f559cda4606e25a04b.zip
gdb-d19df9b51f33394c53d221f559cda4606e25a04b.tar.gz
gdb-d19df9b51f33394c53d221f559cda4606e25a04b.tar.bz2
Wed Jan 31 12:55:49 1996 Richard Henderson <rth@tamu.edu>
* coff-aux.c: New file. * hosts/m68kaux.h: New file. * config.bfd (m68*-apple-aux*): New target. * configure.in (m68*-apple-aux*): New native host. (m68kaux_coff_vec): New vector. * configure: Rebuild. * targets.c (m68kaux_coff_vec): Declare. * coffcode.h (bfd_coff_backend_data): Add field _bfd_coff_link_add_one_symbol. (bfd_coff_link_add_one_symbol): Define. (compare_arelent_ptr): New static function if TARG_AUX. (coff_write_relocs): If TARG_AUX, sort the relocs. (coff_write_object_contents): Set A/UX aouthdr magic number. (coff_link_add_one_symbol): Define if not defined. (bfd_coff_std_swap_table): Initialize new field. * libcoff.h: Rebuild. * cofflink.c (coff_link_add_symbols): Call bfd_coff_link_add_one_symbol rather than _bfd_generic_link_add_one_symbol. * coff-m68k.c (COFF_PAGE_SIZE): Don't define if already defined. * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field. * coff-mips.c (mips_ecoff_backend_data): Likewise. * Makefile.in: Rebuild dependencies. (BFD32_BACKENDS): Add coff-aux.o. (BFD32_BACKENDS_CFILES): Add coff-aux.c.
-rw-r--r--bfd/.Sanitize3
-rw-r--r--bfd/ChangeLog28
-rw-r--r--bfd/Makefile.in5
-rw-r--r--bfd/coff-aux.c332
-rw-r--r--bfd/coffcode.h93
-rwxr-xr-xbfd/config.bfd5
-rwxr-xr-xbfd/configure112
-rw-r--r--bfd/hosts/.Sanitize1
-rw-r--r--bfd/hosts/m68kaux.h16
-rw-r--r--bfd/libcoff.h17
10 files changed, 559 insertions, 53 deletions
diff --git a/bfd/.Sanitize b/bfd/.Sanitize
index 5e4ae30..5d0217b 100644
--- a/bfd/.Sanitize
+++ b/bfd/.Sanitize
@@ -73,9 +73,10 @@ cf-m68klynx.c
cf-sparclynx.c
cisco-core.c
coff-a29k.c
-coff-arm.c
coff-alpha.c
coff-apollo.c
+coff-arm.c
+coff-aux.c
coff-go32.c
coff-h8300.c
coff-h8500.c
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index af52110..2a3afef 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,31 @@
+Wed Jan 31 12:55:49 1996 Richard Henderson <rth@tamu.edu>
+
+ * coff-aux.c: New file.
+ * hosts/m68kaux.h: New file.
+ * config.bfd (m68*-apple-aux*): New target.
+ * configure.in (m68*-apple-aux*): New native host.
+ (m68kaux_coff_vec): New vector.
+ * configure: Rebuild.
+ * targets.c (m68kaux_coff_vec): Declare.
+ * coffcode.h (bfd_coff_backend_data): Add field
+ _bfd_coff_link_add_one_symbol.
+ (bfd_coff_link_add_one_symbol): Define.
+ (compare_arelent_ptr): New static function if TARG_AUX.
+ (coff_write_relocs): If TARG_AUX, sort the relocs.
+ (coff_write_object_contents): Set A/UX aouthdr magic number.
+ (coff_link_add_one_symbol): Define if not defined.
+ (bfd_coff_std_swap_table): Initialize new field.
+ * libcoff.h: Rebuild.
+ * cofflink.c (coff_link_add_symbols): Call
+ bfd_coff_link_add_one_symbol rather than
+ _bfd_generic_link_add_one_symbol.
+ * coff-m68k.c (COFF_PAGE_SIZE): Don't define if already defined.
+ * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
+ * coff-mips.c (mips_ecoff_backend_data): Likewise.
+ * Makefile.in: Rebuild dependencies.
+ (BFD32_BACKENDS): Add coff-aux.o.
+ (BFD32_BACKENDS_CFILES): Add coff-aux.c.
+
Wed Jan 31 11:37:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf32-m68k.c (elf_m68k_relocate_section): Fix R_68K_GOT*
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 2bea498..dec54f3 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -166,6 +166,7 @@ BFD32_BACKENDS = \
coff-a29k.o \
coff-apollo.o \
coff-arm.o \
+ coff-aux.o \
coff-h8300.o \
coff-h8500.o \
coff-i386.o \
@@ -252,6 +253,7 @@ BFD32_BACKENDS_CFILES = \
coff-a29k.c \
coff-apollo.c \
coff-arm.c \
+ coff-aux.c \
coff-h8300.c \
coff-h8500.c \
coff-i386.c \
@@ -787,6 +789,9 @@ coff-apollo.o: coff-apollo.c $(INCDIR)/coff/apollo.h \
coffcode.h coffswap.h
coff-arm.o: coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+coff-aux.o: coff-aux.c $(INCDIR)/coff/aux.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/m68k.h coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
coff-h8300.o: coff-h8300.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/h8300.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-h8500.o: coff-h8500.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/h8500.h \
diff --git a/bfd/coff-aux.c b/bfd/coff-aux.c
new file mode 100644
index 0000000..c94eb3e
--- /dev/null
+++ b/bfd/coff-aux.c
@@ -0,0 +1,332 @@
+/* BFD back-end for Apple M68K COFF A/UX 3.x files.
+ Copyright 1996 Free Software Foundation, Inc.
+ Portions written by Richard Henderson <rth@tamu.edu>,
+ COMMON symbol munging cribbed from cf-m68klynx.c which was
+ written by Cygnus Support.
+
+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. */
+
+#define TARGET_SYM m68kaux_coff_vec
+#define TARGET_NAME "coff-m68k-aux"
+
+#ifndef TARG_AUX
+#define TARG_AUX
+#endif
+
+#define COFF_LONG_FILENAMES
+
+/* 4k pages */
+#define COFF_PAGE_SIZE 0x1000
+
+/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
+#define BSS_NOLOAD_IS_SHARED_LIBRARY
+
+#define _bfd_m68kcoff_howto_table _bfd_m68kaux_howto_table
+#define _bfd_m68kcoff_rtype2howto _bfd_m68kaux_rtype2howto
+#define _bfd_m68kcoff_howto2rtype _bfd_m68kaux_howto2rtype
+#define _bfd_m68kcoff_reloc_type_lookup _bfd_m68kaux_reloc_type_lookup
+
+/* Rather than change names lots of places, reuse the same hack */
+#define LYNX_SPECIAL_FN _bfd_m68kaux_special_fn
+
+#include "bfd.h"
+#include "sysdep.h"
+
+#ifdef ANSI_PROTOTYPES
+struct internal_reloc;
+struct coff_link_hash_entry;
+struct internal_syment;
+#endif
+
+
+static bfd_reloc_status_type _bfd_m68kaux_special_fn
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *coff_m68k_aux_rtype_to_howto
+ PARAMS ((bfd *, asection *, struct internal_reloc *,
+ struct coff_link_hash_entry *, struct internal_syment *,
+ bfd_vma *));
+static boolean coff_m68k_aux_link_add_one_symbol
+ PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+ asection *, bfd_vma, const char *, boolean, boolean,
+ struct bfd_link_hash_entry **));
+
+
+#define coff_rtype_to_howto coff_m68k_aux_rtype_to_howto
+#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
+
+
+/* Compute the addend of a reloc. If the reloc is to a common symbol,
+ the object file contains the value of the common symbol. By the
+ time this is called, the linker may be using a different symbol
+ from a different object file with a different value. Therefore, we
+ hack wildly to locate the original symbol from this file so that we
+ can make the correct adjustment. This macro sets coffsym to the
+ symbol from the original file, and uses it to set the addend value
+ correctly. If this is not a common symbol, the usual addend
+ calculation is done, except that an additional tweak is needed for
+ PC relative relocs.
+ FIXME: This macro refers to symbols and asect; these are from the
+ calling function, not the macro arguments. */
+
+#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
+ { \
+ coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
+ coffsym = (obj_symbols (abfd) \
+ + (cache_ptr->sym_ptr_ptr - symbols)); \
+ else if (ptr) \
+ coffsym = coff_symbol_from (abfd, ptr); \
+ if (coffsym != (coff_symbol_type *) NULL \
+ && coffsym->native->u.syment.n_scnum == 0) \
+ cache_ptr->addend = - coffsym->native->u.syment.n_value; \
+ else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
+ && ptr->section != (asection *) NULL) \
+ cache_ptr->addend = - (ptr->section->vma + ptr->value); \
+ else \
+ cache_ptr->addend = 0; \
+ if (ptr && (reloc.r_type == R_PCRBYTE \
+ || reloc.r_type == R_PCRWORD \
+ || reloc.r_type == R_PCRLONG)) \
+ cache_ptr->addend += asect->vma; \
+ }
+
+
+
+#include "coff/aux.h" /* override coff/internal.h and coff/m68k.h */
+#include "coff-m68k.c"
+
+
+
+/* For some reason when using m68k COFF the value stored in the .text
+ section for a reference to a common symbol is the value itself plus
+ any desired offset. (taken from work done by Ian Taylor, Cygnus Support,
+ for I386 COFF). */
+
+/* If we are producing relocateable output, we need to do some
+ adjustments to the object file that are not done by the
+ bfd_perform_relocation function. This function is called by every
+ reloc type to make any required adjustments. */
+
+static bfd_reloc_status_type
+_bfd_m68kaux_special_fn (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ symvalue diff;
+
+ if (output_bfd == (bfd *) NULL)
+ return bfd_reloc_continue;
+
+ if (bfd_is_com_section (symbol->section))
+ {
+ /* We are relocating a common symbol. The current value in the
+ object file is ORIG + OFFSET, where ORIG is the value of the
+ common symbol as seen by the object file when it was compiled
+ (this may be zero if the symbol was undefined) and OFFSET is
+ the offset into the common symbol (normally zero, but may be
+ non-zero when referring to a field in a common structure).
+ ORIG is the negative of reloc_entry->addend, which is set by
+ the CALC_ADDEND macro below. We want to replace the value in
+ the object file with NEW + OFFSET, where NEW is the value of
+ the common symbol which we are going to put in the final
+ object file. NEW is symbol->value. */
+ diff = symbol->value + reloc_entry->addend;
+ }
+ else
+ {
+ /* For some reason bfd_perform_relocation always effectively
+ ignores the addend for a COFF target when producing
+ relocateable output. This seems to be always wrong for 386
+ COFF, so we handle the addend here instead. */
+ diff = reloc_entry->addend;
+ }
+
+#define DOIT(x) \
+ x = ((x & ~howto->dst_mask) | \
+ (((x & howto->src_mask) + diff) & howto->dst_mask))
+
+ if (diff != 0)
+ {
+ reloc_howto_type *howto = reloc_entry->howto;
+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+
+ switch (howto->size)
+ {
+ case 0:
+ {
+ char x = bfd_get_8 (abfd, addr);
+ DOIT (x);
+ bfd_put_8 (abfd, x, addr);
+ }
+ break;
+
+ case 1:
+ {
+ short x = bfd_get_16 (abfd, addr);
+ DOIT (x);
+ bfd_put_16 (abfd, x, addr);
+ }
+ break;
+
+ case 2:
+ {
+ long x = bfd_get_32 (abfd, addr);
+ DOIT (x);
+ bfd_put_32 (abfd, x, addr);
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Now let bfd_perform_relocation finish everything up. */
+ return bfd_reloc_continue;
+}
+
+
+/* coff-m68k.c uses the special COFF backend linker. We need to
+ adjust common symbols. */
+
+/*ARGSUSED*/
+static reloc_howto_type *
+coff_m68k_aux_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
+ bfd *abfd;
+ asection *sec;
+ struct internal_reloc *rel;
+ struct coff_link_hash_entry *h;
+ struct internal_syment *sym;
+ bfd_vma *addendp;
+{
+ arelent relent;
+ reloc_howto_type *howto;
+
+ RTYPE2HOWTO (&relent, rel);
+
+ howto = relent.howto;
+
+ if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
+ {
+ /* This is a common symbol. The section contents include the
+ size (sym->n_value) as an addend. The relocate_section
+ function will be adding in the final value of the symbol. We
+ need to subtract out the current size in order to get the
+ correct result. */
+ BFD_ASSERT (h != NULL);
+ *addendp -= sym->n_value;
+ }
+
+ /* If the output symbol is common (in which case this must be a
+ relocateable link), we need to add in the final size of the
+ common symbol. */
+ if (h != NULL && h->root.type == bfd_link_hash_common)
+ *addendp += h->root.u.c.size;
+
+ return howto;
+}
+
+
+/* We need non-absolute symbols to override absolute symbols. This
+ mirrors Apple's "solution" to let a static library symbol override
+ a shared library symbol. On the whole not a good thing, given how
+ shared libraries work here, but can work if you are careful with
+ what you include in the shared object. */
+
+boolean
+coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
+ string, copy, collect, hashp)
+ struct bfd_link_info *info;
+ bfd *abfd;
+ const char *name;
+ flagword flags;
+ asection *section;
+ bfd_vma value;
+ const char *string;
+ boolean copy;
+ boolean collect;
+ struct bfd_link_hash_entry **hashp;
+{
+ struct bfd_link_hash_entry *h;
+
+ if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 &&
+ !bfd_is_und_section (section) &&
+ !bfd_is_com_section (section))
+ {
+ /* The new symbol is a definition or an indirect definition */
+
+ /* This bit copied from linker.c */
+ if (hashp != NULL && *hashp != NULL)
+ {
+ h = *hashp;
+ BFD_ASSERT (strcmp (h->root.string, name) == 0);
+ }
+ else
+ {
+ h = bfd_link_hash_lookup (info->hash, name, true, copy, false);
+ if (h == NULL)
+ {
+ if (hashp != NULL)
+ *hashp = NULL;
+ return false;
+ }
+ }
+
+ if (info->notice_hash != (struct bfd_hash_table *) NULL
+ && (bfd_hash_lookup (info->notice_hash, name, false, false)
+ != (struct bfd_hash_entry *) NULL))
+ {
+ if (! (*info->callbacks->notice) (info, name, abfd, section, value))
+ return false;
+ }
+
+ if (hashp != (struct bfd_link_hash_entry **) NULL)
+ *hashp = h;
+ /* end duplication from linker.c */
+
+ if (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_indirect)
+ {
+ asection *msec;
+
+ if (h->type == bfd_link_hash_defined)
+ msec = h->u.def.section;
+ else
+ msec = bfd_ind_section_ptr;
+
+ if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section))
+ {
+ h->u.def.section = section;
+ h->u.def.value = value;
+ return true;
+ }
+ else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
+ return true;
+ }
+ }
+
+ /* If we didn't exit early, finish processing in the generic routine */
+ return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
+ value, string, copy, collect,
+ hashp);
+}
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 58d0f5c..9699f31 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -726,6 +726,17 @@ dependent COFF routines:
. asection *sec,
. struct internal_reloc *reloc,
. boolean *adjustedp));
+. boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
+. struct bfd_link_info *info,
+. bfd *abfd,
+. const char *name,
+. flagword flags,
+. asection *section,
+. bfd_vma value,
+. const char *string,
+. boolean copy,
+. boolean collect,
+. struct bfd_link_hash_entry **hashp));
.
.} bfd_coff_backend_data;
.
@@ -833,6 +844,10 @@ dependent COFF routines:
.#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
. (obfd, info, ibfd, sec, rel, adjustedp))
+.#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
+. value, string, cp, coll, hashp)\
+. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
+. (info, abfd, name, flags, section, value, string, cp, coll, hashp))
.
*/
@@ -1114,16 +1129,8 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
xcoff = xcoff_data (abfd);
xcoff->full_aouthdr = true;
xcoff->toc = internal_a->o_toc;
- if (internal_a->o_sntoc == 0)
- xcoff->toc_section = NULL;
- else
- xcoff->toc_section =
- coff_section_from_bfd_index (abfd, internal_a->o_sntoc);
- if (internal_a->o_snentry == 0)
- xcoff->entry_section = NULL;
- else
- xcoff->entry_section =
- coff_section_from_bfd_index (abfd, internal_a->o_snentry);
+ xcoff->sntoc = internal_a->o_sntoc;
+ xcoff->snentry = internal_a->o_snentry;
xcoff->text_align_power = internal_a->o_algntext;
xcoff->data_align_power = internal_a->o_algndata;
xcoff->modtype = internal_a->o_modtype;
@@ -1553,18 +1560,50 @@ SUBSUBSECTION
*/
+#ifdef TARG_AUX
+
+static int compare_arelent_ptr PARAMS ((const PTR, const PTR));
+
+/* AUX's ld wants relocations to be sorted */
+static int
+compare_arelent_ptr (x, y)
+ const PTR x;
+ const PTR y;
+{
+ const arelent **a = (const arelent **) x;
+ const arelent **b = (const arelent **) y;
+ bfd_size_type aadr = (*a)->address;
+ bfd_size_type badr = (*b)->address;
+
+ return (aadr < badr ? -1 : badr < aadr ? 1 : 0);
+}
+
+#endif /* TARG_AUX */
+
static boolean
coff_write_relocs (abfd, first_undef)
bfd * abfd;
int first_undef;
{
asection *s;
+
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
unsigned int i;
struct external_reloc dst;
+ arelent **p;
+
+#ifndef TARG_AUX
+ p = s->orelocation;
+#else
+ /* sort relocations before we write them out */
+ p = (arelent **) bfd_malloc (s->reloc_count * sizeof (arelent *));
+ if (p == NULL && s->reloc_count > 0)
+ return false;
+ memcpy (p, s->orelocation, s->reloc_count * sizeof (arelent *));
+ qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr);
+#endif
- arelent **p = s->orelocation;
if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
return false;
for (i = 0; i < s->reloc_count; i++)
@@ -1639,6 +1678,11 @@ coff_write_relocs (abfd, first_undef)
if (bfd_write ((PTR) & dst, 1, RELSZ, abfd) != RELSZ)
return false;
}
+
+#ifdef TARG_AUX
+ if (p != NULL)
+ free (p);
+#endif
}
return true;
@@ -2438,9 +2482,15 @@ coff_write_object_contents (abfd)
#if defined(LYNXOS)
internal_a.magic = LYNXCOFFMAGIC;
#else
+#if defined(TARG_AUX)
+ internal_a.magic = (abfd->flags & D_PAGED ? PAGEMAGICPEXECPAGED :
+ abfd->flags & WP_TEXT ? PAGEMAGICPEXECSWAPPED :
+ PAGEMAGICEXECSWAPPED);
+#else
#if defined (PAGEMAGICPEXECPAGED)
internal_a.magic = PAGEMAGICPEXECPAGED;
#endif
+#endif /* TARG_AUX */
#endif /* LYNXOS */
#endif /* M68 || WE32K || M68K */
@@ -2569,13 +2619,9 @@ coff_write_object_contents (abfd)
internal_a.vstamp = 1;
- if (xcoff_data (abfd)->entry_section != NULL)
- internal_a.o_snentry = xcoff_data (abfd)->entry_section->target_index;
- else
- {
- internal_a.o_snentry = 0;
- internal_a.entry = (bfd_vma) -1;
- }
+ internal_a.o_snentry = xcoff_data (abfd)->snentry;
+ if (internal_a.o_snentry == 0)
+ internal_a.entry = (bfd_vma) -1;
if (text_sec != NULL)
{
@@ -2609,10 +2655,7 @@ coff_write_object_contents (abfd)
toc = xcoff_data (abfd)->toc;
internal_a.o_toc = toc;
- if (xcoff_data (abfd)->toc_section == NULL)
- internal_a.o_sntoc = 0;
- else
- internal_a.o_sntoc = xcoff_data (abfd)->toc_section->target_index;
+ internal_a.o_sntoc = xcoff_data (abfd)->sntoc;
internal_a.o_modtype = xcoff_data (abfd)->modtype;
if (xcoff_data (abfd)->cputype != -1)
@@ -3489,6 +3532,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#define coff_adjust_symndx NULL
#endif
+#ifndef coff_link_add_one_symbol
+#define coff_link_add_one_symbol _bfd_generic_link_add_one_symbol
+#endif
+
static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
{
coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in,
@@ -3509,7 +3556,7 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table =
coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
coff_sym_is_global, coff_compute_section_file_positions,
coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
- coff_adjust_symndx
+ coff_adjust_symndx, coff_link_add_one_symbol
};
#define coff_close_and_cleanup _bfd_generic_close_and_cleanup
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 59cb5fb..a1d28f7 100755
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -129,7 +129,7 @@ case "${targ}" in
;;
i[345]86-*-sysv4* | i[345]86-*-unixware | i[345]86-*-solaris2* | \
- i[345]86-*-elf)
+ i[345]86-*-elf | i[345]86-*-sco*elf*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
@@ -288,6 +288,9 @@ case "${targ}" in
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs=m68kcoff_vec
;;
+ m68*-apple-aux*)
+ targ_defvec=m68kaux_coff_vec
+ ;;
m88*-harris-cxux* | m88*-*-dgux* | m88*-*-sysv4*)
targ_defvec=bfd_elf32_m88k_vec
diff --git a/bfd/configure b/bfd/configure
index c0f0800..b4597da 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.6
+# Generated automatically using autoconf version 2.7
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -336,7 +336,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.6"
+ echo "configure generated by autoconf version 2.7"
exit 0 ;;
-with-* | --with-*)
@@ -668,8 +668,10 @@ fi
if test "$program_transform_name" = s,x,x,; then
program_transform_name=
else
- # Double any \ or $.
- echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
rm -f conftestsed
fi
@@ -899,7 +901,7 @@ else
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 903 "configure"
+#line 905 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
@@ -941,7 +943,7 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 945 "configure"
+#line 947 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
@@ -955,7 +957,7 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 959 "configure"
+#line 961 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
@@ -988,7 +990,7 @@ 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 992 "configure"
+#line 994 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@@ -1024,7 +1026,7 @@ 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 1028 "configure"
+#line 1030 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@@ -1059,7 +1061,7 @@ 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 1063 "configure"
+#line 1065 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1118,7 +1120,7 @@ if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1122 "configure"
+#line 1124 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -1158,7 +1160,7 @@ if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1162 "configure"
+#line 1164 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -1366,6 +1368,13 @@ EOF
EOF
;;
+ m68*-apple-aux*)
+ COREFILE=trad-core.o
+ cat >> confdefs.h <<\EOF
+#define TRAD_HEADER "hosts/m68kaux.h"
+EOF
+
+ ;;
m88*-*-sysv4*) ;;
m88*-motorola-sysv*) COREFILE=ptrace-core.o ;;
m88*-*-mach3*)
@@ -1451,7 +1460,7 @@ EOF
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1455 "configure"
+#line 1464 "configure"
#include "confdefs.h"
#include <sys/procfs.h>
int main() { return 0; }
@@ -1608,8 +1617,9 @@ do
hp300hpux_vec) tb="$tb hp300hpux.o aout32.o stab-syms.o" ;;
i386aout_vec) tb="$tb i386aout.o aout32.o stab-syms.o" ;;
i386bsd_vec) tb="$tb i386bsd.o aout32.o stab-syms.o" ;;
- i386dynix_vec) tb="$tb i386dynix.o aout32.o stab-syms.o" ;;
i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;;
+ i386dynix_vec) tb="$tb i386dynix.o aout32.o stab-syms.o" ;;
+ i386freebsd_vec) tb="$tb i386freebsd.o aout32.o stab-syms.o" ;;
i386msdos_vec) tb="$tb i386msdos.o" ;;
i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;;
i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;;
@@ -1629,6 +1639,7 @@ do
m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o stab-syms.o" ;;
m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o stab-syms.o" ;;
m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o stab-syms.o" ;;
+ m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;;
m88kbcs_vec) tb="$tb coff-m88k.o" ;;
newsos3_vec) tb="$tb newsos3.o aout32.o stab-syms.o" ;;
nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;;
@@ -1729,6 +1740,57 @@ test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
+for ac_func in valloc getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+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 1751 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+char $ac_func();
+
+int main() { return 0; }
+int t() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if eval $ac_link; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1737,7 +1799,7 @@ else
ac_cv_func_mmap=no
else
cat > conftest.$ac_ext <<EOF
-#line 1741 "configure"
+#line 1803 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test. */
@@ -1745,12 +1807,6 @@ cat > conftest.$ac_ext <<EOF
#include <fcntl.h>
#include <sys/mman.h>
-#ifdef BSD
-# ifndef BSD4_1
-# define HAVE_GETPAGESIZE
-# endif
-#endif
-
#ifndef HAVE_GETPAGESIZE
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
@@ -1771,7 +1827,7 @@ cat > conftest.$ac_ext <<EOF
# endif
#endif
-#ifdef __osf__
+#ifndef HAVE_VALLOC
# define valloc malloc
#endif
@@ -1786,7 +1842,7 @@ main()
{
char *buf1, *buf2, *buf3;
int i = getpagesize(), j;
- int i2 = getpagesize()*2;
+ int i2 = i * 2;
int fd;
buf1 = (char *)valloc(i2);
@@ -1837,7 +1893,7 @@ 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 1841 "configure"
+#line 1897 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1965,7 +2021,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.6"
+ echo "$CONFIG_STATUS generated by autoconf version 2.7"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -1977,10 +2033,12 @@ ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile doc/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
s%@CFLAGS@%$CFLAGS%g
diff --git a/bfd/hosts/.Sanitize b/bfd/hosts/.Sanitize
index 39ef327..aa1993f 100644
--- a/bfd/hosts/.Sanitize
+++ b/bfd/hosts/.Sanitize
@@ -35,6 +35,7 @@ i386mach3.h
i386nbsd.h
i386sco.h
i860mach3.h
+m68kaux.h
m68knbsd.h
m88kmach3.h
mipsbsd.h
diff --git a/bfd/hosts/m68kaux.h b/bfd/hosts/m68kaux.h
new file mode 100644
index 0000000..6237755
--- /dev/null
+++ b/bfd/hosts/m68kaux.h
@@ -0,0 +1,16 @@
+/* Definitions for an Apple Macintosh running A/UX 3.x. */
+
+#include <sys/param.h>
+#include <sys/page.h>
+
+/* Definitions used by trad-core.c. */
+#define NBPG NBPP
+
+#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg
+#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg
+#define HOST_STACK_END_ADDR 0x100000000
+
+#define UPAGES USIZE
+
+#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
+ (abfd->tdata.trad_core_data->u.u_arg[0])
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 289c033..045621f 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -1,5 +1,5 @@
/* BFD COFF object file private structure.
- Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -696,6 +696,17 @@ typedef struct
asection *sec,
struct internal_reloc *reloc,
boolean *adjustedp));
+ boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
+ struct bfd_link_info *info,
+ bfd *abfd,
+ const char *name,
+ flagword flags,
+ asection *section,
+ bfd_vma value,
+ const char *string,
+ boolean copy,
+ boolean collect,
+ struct bfd_link_hash_entry **hashp));
} bfd_coff_backend_data;
@@ -803,4 +814,8 @@ typedef struct
#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
(obfd, info, ibfd, sec, rel, adjustedp))
+#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
+ value, string, cp, coll, hashp)\
+ ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
+ (info, abfd, name, flags, section, value, string, cp, coll, hashp))