public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Binutils <binutils@sourceware.org>
Cc: Alan Modra <amodra@gmail.com>
Subject: Re: PATCH: PR ld/12507: Can't build a program with -flto -nostdlib
Date: Sat, 26 Feb 2011 04:33:00 -0000	[thread overview]
Message-ID: <AANLkTi=snRcES-xUidS4cL6i9Y6haO3=aQS220T010eq@mail.gmail.com> (raw)
In-Reply-To: <20110225235859.GE5959@bubble.grove.modra.org>

On Fri, Feb 25, 2011 at 3:58 PM, Alan Modra <amodra@gmail.com> wrote:
> On Fri, Feb 25, 2011 at 03:45:14PM -0800, H.J. Lu wrote:
>> On Fri, Feb 25, 2011 at 3:29 PM, Alan Modra <amodra@gmail.com> wrote:
>> > It would be better to put the entry symbol, and -u syms on the
>> > entry_symbol chain, into non_ironly_hash.
>>
>> I tried it and it doesn't work.
>
> How so?
>
>> Also, we only care about the entry symbol for LTO.
>
> I'd be a little surprised if there is a good reason to treat -u syms
> any differently from references in non-ir object files.
>

This patch works.

-- 
H.J.
---
diff --git a/ld/plugin.c b/ld/plugin.c
index 7892e36..40acbdb 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -492,8 +492,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin
_symbol *syms)
 	 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)
-		&& strcmp (syms[n].name, entry_symbol.name) != 0);
+				     FALSE, FALSE));

       /* If it was originally undefined or common, then it has been
 	 resolved; determine how.  */
@@ -838,6 +837,8 @@ plugin_call_cleanup (void)
 static void
 init_non_ironly_hash (void)
 {
+  struct bfd_sym_chain *sym;
+
   if (non_ironly_hash == NULL)
     {
       non_ironly_hash =
@@ -847,6 +848,12 @@ init_non_ironly_hash (void)
 				  sizeof (struct bfd_hash_entry),
 				  61))
 	einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
+
+      for (sym = &entry_symbol; sym != NULL; sym = sym->next)
+	if (sym->name
+	    && !bfd_hash_lookup (non_ironly_hash, sym->name, TRUE, TRUE))
+	  einfo (_("%P%X: hash table failure adding symbol %s\n"),
+		 sym->name);
     }
 }

  parent reply	other threads:[~2011-02-26  4:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 22:59 H.J. Lu
2011-02-25 22:45 ` Dave Korn
2011-02-25 23:08   ` H.J. Lu
2011-02-25 23:30 ` Alan Modra
2011-02-25 23:45   ` H.J. Lu
2011-02-25 23:59     ` Alan Modra
2011-02-26  0:09       ` Rafael Ávila de Espíndola
2011-02-26  4:34         ` H.J. Lu
2011-02-26  5:16           ` Rafael Ávila de Espíndola
2011-02-26  5:32             ` H.J. Lu
2011-02-26  4:33       ` H.J. Lu [this message]
2011-02-26  4:36         ` H.J. Lu
2011-02-26  9:04         ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=snRcES-xUidS4cL6i9Y6haO3=aQS220T010eq@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).