PATCH: PR ld/12507: Can't build a program with -flto -nostdlib
Dave Korn
dave.korn.cygwin@gmail.com
Fri Feb 25 22:45:00 GMT 2011
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?
cheers,
DaveK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12507-part2.diff
Type: text/x-c
Size: 726 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110225/2fced5af/attachment.bin>
More information about the Binutils
mailing list