From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20842 invoked by alias); 7 Jun 2011 09:08:57 -0000 Received: (qmail 20833 invoked by uid 22791); 7 Jun 2011 09:08:56 -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,RFC_ABUSE_POST,TW_CP,TW_CQ 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; Tue, 07 Jun 2011 09:08:40 +0000 Received: by iyl8 with SMTP id 8so4706247iyl.0 for ; Tue, 07 Jun 2011 02:08:39 -0700 (PDT) Received: by 10.231.128.199 with SMTP id l7mr9130294ibs.150.1307437718753; Tue, 07 Jun 2011 02:08:38 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id v15sm2067640ibh.45.2011.06.07.02.08.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Jun 2011 02:08:37 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 0510D170C1A4; Tue, 7 Jun 2011 18:38:31 +0930 (CST) Date: Tue, 07 Jun 2011 09:08:00 -0000 From: Alan Modra To: Roland McGrath Cc: bug-binutils@gnu.org, binutils@sourceware.org Subject: Re: .gnu.warning.foo interferes with archive-member rules Message-ID: <20110607090830.GA4172@bubble.grove.modra.org> Mail-Followup-To: Roland McGrath , bug-binutils@gnu.org, binutils@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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-06/txt/msg00064.txt.bz2 On Mon, Jun 06, 2011 at 03:41:14PM -0700, Roland McGrath wrote: > Consider: > > % head ref.s def.s > ==> ref.s <== > .data > ptrsym: > .long badsym > > .section .gnu.warning.badsym,"",@progbits > .string "badsym warning" > > ==> def.s <== > .comm badsym,4 > % as --32 -o ref.o ref.s > % as --32 -o def.o def.s > % ar cqs def.a def.o > % ./ld/ld-new -m elf_i386 -o foo ref.o def.a > ref.o: In function `ptrsym': > (.data+0x0): warning: badsym warning > ./ld/ld-new: warning: cannot find entry symbol _start; defaulting to 0000000008048054 > ref.o: In function `ptrsym': > (.data+0x0): undefined reference to `badsym' > [Exit 1] > % I think you've managed to hit two bugs. I'll commit the following after some testing. bfd/ * elflink.c (_bfd_elf_archive_symbol_lookup): Follow warning and indirect links here. ld/ * ldlang.c (lang_one_common): Handle warning symbols. Index: bfd/elflink.c =================================================================== RCS file: /cvs/src/src/bfd/elflink.c,v retrieving revision 1.406 diff -u -p -r1.406 elflink.c --- bfd/elflink.c 26 May 2011 04:28:20 -0000 1.406 +++ bfd/elflink.c 7 Jun 2011 09:03:39 -0000 @@ -4911,7 +4911,7 @@ _bfd_elf_archive_symbol_lookup (bfd *abf char *p, *copy; size_t len, first; - h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); + h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, TRUE); if (h != NULL) return h; @@ -4934,14 +4934,14 @@ _bfd_elf_archive_symbol_lookup (bfd *abf memcpy (copy, name, first); memcpy (copy + first, name + first + 1, len - first); - h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, FALSE); + h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, TRUE); if (h == NULL) { /* We also need to check references to the symbol without the version. */ copy[first - 1] = '\0'; h = elf_link_hash_lookup (elf_hash_table (info), copy, - FALSE, FALSE, FALSE); + FALSE, FALSE, TRUE); } bfd_release (abfd, copy); Index: ld/ldlang.c =================================================================== RCS file: /cvs/src/src/ld/ldlang.c,v retrieving revision 1.370 diff -u -p -r1.370 ldlang.c --- ld/ldlang.c 23 May 2011 05:41:01 -0000 1.370 +++ ld/ldlang.c 7 Jun 2011 09:03:41 -0000 @@ -5885,6 +5885,9 @@ lang_one_common (struct bfd_link_hash_en bfd_vma size; asection *section; + if (h->type == bfd_link_hash_warning) + h = h->u.i.link; + if (h->type != bfd_link_hash_common) return TRUE; -- Alan Modra Australia Development Lab, IBM