forked from Imagelibrary/binutils-gdb
Skip gc-sections if relocation is incompatible
This patch skips gc-sections if input relocation is incompatible with output. bfd/ PR ld/18160 * elflink.c (elf_gc_sweep): Skip if relocation is incompatible. (bfd_elf_gc_sections): Likewise. ld/testsuite/ PR ld/18160 * ld-x86-64/pr18160.d: New file. * ld-x86-64/pr18160.s: Likewise. * ld-x86-64/pr18160.t: Likewise. * ld-x86-64/x86-64.exp: Run pr18160.
This commit is contained in:
@@ -12159,7 +12159,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
asection *o;
|
||||
|
||||
if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
|
||||
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|
||||
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
|
||||
continue;
|
||||
|
||||
for (o = sub->sections; o != NULL; o = o->next)
|
||||
@@ -12446,7 +12447,8 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
asection *o;
|
||||
|
||||
if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
|
||||
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|
||||
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
|
||||
continue;
|
||||
|
||||
/* Start at sections marked with SEC_KEEP (ref _bfd_elf_gc_keep).
|
||||
|
||||
Reference in New Issue
Block a user