This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/12507: Can't build a program with -flto -nostdlib
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 25 Feb 2011 15:08:23 -0800
- Subject: Re: PATCH: PR ld/12507: Can't build a program with -flto -nostdlib
- References: <20110224225913.GA3169@intel.com> <4D683105.70307@gmail.com>
On Fri, Feb 25, 2011 at 2:45 PM, Dave Korn <dave.korn.cygwin@gmail.com> wrote:
> On 24/02/2011 22:59, H.J. Lu wrote:
>> We should never mark entry symbol IR only. I checked in this patch as
>> an obvious fix.
>
>> --- a/ld/plugin.c
>> +++ b/ld/plugin.c
>> @@ -490,8 +490,10 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms)
>> ? ? ? ?even potentially-referenced, perhaps in a future final link if
>> ? ? ? ?this is a partial one, perhaps dynamically at load-time if the
>> ? ? ? ?symbol is externally visible. ?*/
>> - ? ? ?ironly = !is_visible_from_outside (&syms[n], owner_sec, blhe)
>> - ? ? && !bfd_hash_lookup (non_ironly_hash, syms[n].name, FALSE, FALSE);
>> + ? ? ?ironly = (!is_visible_from_outside (&syms[n], owner_sec, blhe)
>> + ? ? ? ? ? ? && !bfd_hash_lookup (non_ironly_hash, syms[n].name,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?FALSE, FALSE)
>> + ? ? ? ? ? ? && strcmp (syms[n].name, entry_symbol.name) != 0);
>
> ?This caused a bunch of regressions for me:
>
>> +FAIL: plugin claimfile resolve symbol
>> +FAIL: plugin claimfile replace file
>> +FAIL: plugin ignore lib
>> +FAIL: plugin claimfile replace lib
>
> ?It turns out that entry_symbol.name can be NULL, and strcmp doesn't have to
> handle null pointers gracefully; it segfaulted on cygwin. ?We need to guard
> the test, like the attached.
>
> ld/ChangeLog:
>
> 2011-02-25 ?Dave Korn ?<....
>
> ? ? ? ?* plugin.c (get_symbols): Guard against NULL name of entry_symbol.
>
> ?OK?
Sorry for that. I consider it obvious.
--
H.J.