aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-10-18 09:13:51 +0000
committerAlan Modra <amodra@gmail.com>2007-10-18 09:13:51 +0000
commit13285a1b2c20277cb2346e9c635c5ea7019441ad (patch)
tree66e7bb4b2fffa19160911f6aeabe396b6fcbedc6 /bfd/elflink.c
parentec4f988b1bb001dc5bffe3f468c7cf8a600795ab (diff)
downloadgdb-13285a1b2c20277cb2346e9c635c5ea7019441ad.zip
gdb-13285a1b2c20277cb2346e9c635c5ea7019441ad.tar.gz
gdb-13285a1b2c20277cb2346e9c635c5ea7019441ad.tar.bz2
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.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index e2dfcef..ba2f540 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;