forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user