[PATCH] PR ld/18160: Segmentation Fault in lang_gc_sections when linking elf_x86_64 output

H.J. Lu hjl.tools@gmail.com
Thu Mar 26 01:14:00 GMT 2015


On Wed, Mar 25, 2015 at 5:38 PM, Alan Modra <amodra@gmail.com> wrote:
> On Wed, Mar 25, 2015 at 04:21:14PM -0700, H.J. Lu wrote:
>> This patch ignores gc-sections if input relocation is incompatible with
>> output.  OK for master?
>
> No.  For one, it looks like you can't call _bfd_elf_relocs_compatible
> with a non-ELF input, which is either a bug in that function or you
> need to first test for ELF.
>
> Secondly, if you take a look at the gc-sections code you'll see that
> it handles non-ELF input files by simply not garbage collecting those
> files.  Your patch would disable gc-sections entirely on finding a
> non-ELF file.  I'm not sure how important it is to keep the old
> behaviour, but I'm guessing you did not intend to make that change.
>

How about this one?

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.

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.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Skip-gc-sections-if-relocation-is-incompatible.patch
Type: text/x-patch
Size: 3125 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150326/29280a73/attachment.bin>


More information about the Binutils mailing list