This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/18160: Segmentation Fault in lang_gc_sections when linking elf_x86_64 output
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Thu, 26 Mar 2015 12:59:25 +1030
- Subject: Re: [PATCH] PR ld/18160: Segmentation Fault in lang_gc_sections when linking elf_x86_64 output
- Authentication-results: sourceware.org; auth=none
- References: <20150325232114 dot GA31855 at gmail dot com> <20150326003816 dot GR26234 at bubble dot grove dot modra dot org> <CAMe9rOpdxRQ2fTcA6nnSkO2YdW8v5TR5CYmy-BFFZzorXXcF7Q at mail dot gmail dot com> <20150326012737 dot GS26234 at bubble dot grove dot modra dot org> <CAMe9rOq=Y6tg8JXmedssm-71zMo9Dm3MMbSyeCfsn=OUagnFPg at mail dot gmail dot com>
On Wed, Mar 25, 2015 at 06:58:25PM -0700, H.J. Lu wrote:
> On Wed, Mar 25, 2015 at 6:27 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Wed, Mar 25, 2015 at 06:14:29PM -0700, H.J. Lu wrote:
> >> 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.
> >
> > Is the warning really necessary? Also, it looks to me that the
> > relocs_compatible test should be in more places, eg. to stop the
> > backend gc_mark_hook from being confused by incompatible relocs.
>
> Like this?
Yes, thanks, this is OK. Do we need a similar test in the .eh_frame
loop that you originally patched? Feel free to add that if you think
so.
--
Alan Modra
Australia Development Lab, IBM