diff options
author | Alan Modra <amodra@bigpond.net.au> | 2007-10-18 09:13:51 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2007-10-18 09:13:51 +0000 |
commit | 07eca6f55f5ca048bad21e36f5a7e6d45682535f (patch) | |
tree | 8012f2bc38cfc9222b0c41070cb8de874cd8b42b /bfd/elflink.c | |
parent | 3e6c164c7fd3e62dca7e9a5e31e16f8d5f75f182 (diff) | |
download | binutils-redhat-07eca6f55f5ca048bad21e36f5a7e6d45682535f.tar.gz |
PR ld/4424
* config.bfd (targ_selvecs): Add bfd_elf64_alpha_vec for
alpha/FreeBSD. Add bfd_elf64_sparc_vec for sparc64/FreeBSD.
Add bfd_elf32_i386_vec and bfd_efi_app_ia32_vec for i386/FreeBSD.
(targ64_selvecs): Set for i386/FreeBSD.
* elf-bfd.h (elf_backend_data): Add relocs_compatible.
(_bfd_elf_default_relocs_compatible): Declare.
(_bfd_elf_relocs_compatible): Declare.
* elfxx-target.h (elf_backend_relocs_compatible): Define.
(elfNN_bed): Init new relocs_compatible field.
* elflink.c (_bfd_elf_default_relocs_compatible): New function.
(_bfd_elf_relocs_compatible): New function.
(elf_link_add_object_symbols): Call bed->relocs_compatible.
* elf32-i386.c (elf_backend_relocs_compatible): Define.
* elf64-alpha.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index e2dfcefb09..ba2f54008b 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -3252,6 +3252,40 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info) return TRUE; } +/* Return TRUE iff relocations for INPUT are compatible with OUTPUT. + The default is to only match when the INPUT and OUTPUT are exactly + the same target. */ + +bfd_boolean +_bfd_elf_default_relocs_compatible (const bfd_target *input, + const bfd_target *output) +{ + return input == output; +} + +/* Return TRUE iff relocations for INPUT are compatible with OUTPUT. + This version is used when different targets for the same architecture + are virtually identical. */ + +bfd_boolean +_bfd_elf_relocs_compatible (const bfd_target *input, + const bfd_target *output) +{ + const struct elf_backend_data *obed, *ibed; + + if (input == output) + return TRUE; + + ibed = xvec_get_elf_backend_data (input); + obed = xvec_get_elf_backend_data (output); + + if (ibed->arch != obed->arch) + return FALSE; + + /* If both backends are using this function, deem them compatible. */ + return ibed->relocs_compatible == obed->relocs_compatible; +} + /* Add symbols from an ELF object file to the linker hash table. */ static bfd_boolean @@ -4639,8 +4673,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) different format. It probably can't be done. */ if (! dynamic && is_elf_hash_table (htab) - && htab->root.creator == abfd->xvec - && bed->check_relocs != NULL) + && bed->check_relocs != NULL + && (*bed->relocs_compatible) (abfd->xvec, htab->root.creator)) { asection *o; |