diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-09-12 21:01:19 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-09-12 21:01:19 +0000 |
commit | 2a895595271b278bfab1041ac916688681aeedec (patch) | |
tree | 82ff7476ed510691ff14edaa5f5747a2a3237b60 /bfd/cf-m68klynx.c | |
parent | 3cd942de1e9a5e19c7132a1de400c6d3d931057b (diff) | |
download | gdb-2a895595271b278bfab1041ac916688681aeedec.zip gdb-2a895595271b278bfab1041ac916688681aeedec.tar.gz gdb-2a895595271b278bfab1041ac916688681aeedec.tar.bz2 |
* cofflink.c (coff_link_input_bfd): If r_symndx is -1, don't
change it.
(_bfd_coff_generic_relocate_section): If r_symndx is -1, it is an
absolute reloc. Don't dump core using r_symndx as an array index.
* cf-m68klynx.c (coff_bfd_link_add_symbols): Define.
(lynx_link_add_symbols): New static function (copy of function in
coff-i386.c).
(coff_m68k_lynxrtype_to_howto): sym argument may be NULL.
* coff-i386.c (coff_i386_rtype_to_howto): Likewise.
* coff-a29k.c (coff_a29k_relocate_section): Handle an r_symndx
value of -1, meaning an absolute reloc.
Diffstat (limited to 'bfd/cf-m68klynx.c')
-rw-r--r-- | bfd/cf-m68klynx.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/bfd/cf-m68klynx.c b/bfd/cf-m68klynx.c index 15c9915..bc6cb29 100644 --- a/bfd/cf-m68klynx.c +++ b/bfd/cf-m68klynx.c @@ -43,6 +43,7 @@ struct internal_syment; static bfd_reloc_status_type _bfd_m68klynx_special_fn PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static boolean lynx_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); static const struct reloc_howto_struct *coff_m68k_lynx_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, @@ -175,14 +176,44 @@ _bfd_m68klynx_special_fn (abfd, reloc_entry, symbol, data, input_section, cache_ptr->addend += asect->vma; \ } +#define coff_bfd_link_add_symbols lynx_link_add_symbols #define coff_rtype_to_howto coff_m68k_lynx_rtype_to_howto #include "coff-m68k.c" +/* On Lynx, we may have a COFF archive which contains a.out elements. + This screws up the COFF linker, which expects that any archive it + gets contains COFF elements. We override the add_symbols function + to check for this case. */ + +static boolean +lynx_link_add_symbols (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + if (bfd_get_format (abfd) == bfd_archive) + { + bfd *first; + + first = bfd_openr_next_archived_file (abfd, (bfd *) NULL); + if (first == NULL) + return false; + if (! bfd_check_format (first, bfd_object)) + return false; + if (bfd_get_flavour (first) != bfd_target_coff_flavour) + { + /* Treat the archive as though it were actually of the + flavour of its first element. This ought to work, + since the archive support is fairly generic. */ + return (*first->xvec->_bfd_link_add_symbols) (abfd, info); + } + } + + return _bfd_coff_link_add_symbols (abfd, info); +} + /* coff-m68k.c uses the special COFF backend linker. We need to - adjust common symbols. FIXME: We may able to get rid of - CALC_ADDEND and _bfd_m68klynx_special_fn. However, they may still - be used by gas. + adjust common symbols. We can't define this function until after we have included coff-m68k.c, because it uses RTYPE2HOWTO. */ @@ -204,7 +235,7 @@ coff_m68k_lynx_rtype_to_howto (abfd, sec, rel, h, sym, addendp) howto = relent.howto; - if (sym->n_scnum == 0 && sym->n_value != 0) + 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 |