aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-03-26 08:22:08 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-03-26 08:22:55 -0700
commitb19a8f8545100a08ee2a64c05631aff6f651faa1 (patch)
treea1400638db4f72f3359a2c20932b58a2d607dbcf /bfd
parent20d35291fb30a2fa5de46af56887f9bc4da7e53e (diff)
downloadgdb-b19a8f8545100a08ee2a64c05631aff6f651faa1.zip
gdb-b19a8f8545100a08ee2a64c05631aff6f651faa1.tar.gz
gdb-b19a8f8545100a08ee2a64c05631aff6f651faa1.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 014e30d..ae84f5f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/18160
+ * elflink.c (elf_gc_sweep): Skip if relocation is incompatible.
+ (bfd_elf_gc_sections): Likewise.
+
2015-03-25 Marcus Shawcroft <marcus.shawcroft@arm.com>
* elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Adjust stub section
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 9ccad8c..748ff1b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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).