From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27314 invoked by alias); 26 Feb 2011 04:36:28 -0000 Received: (qmail 27202 invoked by uid 22791); 26 Feb 2011 04:36:27 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iy0-f169.google.com (HELO mail-iy0-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 26 Feb 2011 04:36:11 +0000 Received: by iyf13 with SMTP id 13so1844456iyf.0 for ; Fri, 25 Feb 2011 20:36:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.166.138 with SMTP id o10mr1832381icy.22.1298694969921; Fri, 25 Feb 2011 20:36:09 -0800 (PST) Received: by 10.42.60.129 with HTTP; Fri, 25 Feb 2011 20:36:09 -0800 (PST) In-Reply-To: References: <20110224225913.GA3169@intel.com> <20110225232948.GD5959@bubble.grove.modra.org> <20110225235859.GE5959@bubble.grove.modra.org> Date: Sat, 26 Feb 2011 04:36:00 -0000 Message-ID: Subject: Re: PATCH: PR ld/12507: Can't build a program with -flto -nostdlib From: "H.J. Lu" To: Binutils Cc: Alan Modra Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00347.txt.bz2 On Fri, Feb 25, 2011 at 8:33 PM, H.J. Lu wrote: > On Fri, Feb 25, 2011 at 3:58 PM, Alan Modra 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 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) > =A0 =A0 =A0 =A0 symbol is externally visible. =A0*/ > =A0 =A0 =A0 ironly =3D (!is_visible_from_outside (&syms[n], owner_sec, bl= he) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&& !bfd_hash_lookup (non_ironly_hash, syms= [n].name, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= FALSE, FALSE) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 && strcmp (syms[n].name, entry_symbol.name)= !=3D 0); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= FALSE, FALSE)); > > =A0 =A0 =A0 /* If it was originally undefined or common, then it has been > =A0 =A0 =A0 =A0 resolved; determine how. =A0*/ > @@ -838,6 +837,8 @@ plugin_call_cleanup (void) > =A0static void > =A0init_non_ironly_hash (void) > =A0{ > + =A0struct bfd_sym_chain *sym; > + > =A0 if (non_ironly_hash =3D=3D NULL) > =A0 =A0 { > =A0 =A0 =A0 non_ironly_hash =3D > @@ -847,6 +848,12 @@ init_non_ironly_hash (void) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sizeof= (struct bfd_hash_entry), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A061)) > =A0 =A0 =A0 =A0einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); > + > + =A0 =A0 =A0for (sym =3D &entry_symbol; sym !=3D NULL; sym =3D sym->next) > + =A0 =A0 =A0 if (sym->name > + =A0 =A0 =A0 =A0 =A0 && !bfd_hash_lookup (non_ironly_hash, sym->name, TR= UE, TRUE)) > + =A0 =A0 =A0 =A0 einfo (_("%P%X: hash table failure adding symbol %s\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sym->name); > =A0 =A0 } > =A0} > I am checking it in. --=20 H.J.