PATCH: PR ld/12507: Can't build a program with -flto -nostdlib
H.J. Lu
hjl.tools@gmail.com
Fri Feb 25 23:08:00 GMT 2011
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.
More information about the Binutils
mailing list