From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15064 invoked by alias); 29 Jul 2007 12:30:29 -0000 Received: (qmail 15056 invoked by uid 22791); 29 Jul 2007 12:30:29 -0000 X-Spam-Check-By: sourceware.org Received: from omta04sl.mx.bigpond.com (HELO omta04sl.mx.bigpond.com) (144.140.93.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 29 Jul 2007 12:30:24 +0000 Received: from oaamta04sl.mx.bigpond.com ([58.174.193.87]) by omta04sl.mx.bigpond.com with ESMTP id <20070729123017.KLIY4018.omta04sl.mx.bigpond.com@oaamta04sl.mx.bigpond.com>; Sun, 29 Jul 2007 12:30:17 +0000 Received: from bubble.grove.modra.org ([58.174.193.87]) by oaamta04sl.mx.bigpond.com with ESMTP id <20070729123017.UIXW22522.oaamta04sl.mx.bigpond.com@bubble.grove.modra.org>; Sun, 29 Jul 2007 12:30:17 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id 530CB386FFA; Sun, 29 Jul 2007 22:00:15 +0930 (CST) Date: Sun, 29 Jul 2007 16:27:00 -0000 From: Alan Modra To: binutils@sources.redhat.com Cc: Roland McGrath , Jakub Jelinek Subject: Re: [PATCH] Issues with ld -shared --build-id Message-ID: <20070729123014.GA4730@bubble.grove.modra.org> Mail-Followup-To: binutils@sources.redhat.com, Roland McGrath , Jakub Jelinek References: <20070724230519.GF27905@bubble.grove.modra.org> <20070724231047.0FEDF4D058D@magilla.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070724231047.0FEDF4D058D@magilla.localdomain> User-Agent: Mutt/1.5.9i 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: 2007-07/txt/msg00519.txt.bz2 On Tue, Jul 24, 2007 at 04:10:47PM -0700, Roland McGrath wrote: > IIUC the proper orphans placing would put it (SHT_NOTE,SHF_ALLOC) there > anyway. This ldlang.c patch fixes the problem Jakub reported, with orphan note sections being placed before the initial "dot" assignment in a linker script. The elf32.em patch improves placement of orphan reloc sections. ld/ * ldlang.c (lang_insert_orphan): When searching through linker script to place an orphan, don't stop on statements that appear outside of SECTIONS. * emultempl/elf32.em (output_rel_find): Prefer read-only alloc sections over read/write alloc sections. ld/testsuite/ * ld-elf/weak-dyn-1.rd: Adjust. Index: ld/ldlang.c =================================================================== RCS file: /cvs/src/src/ld/ldlang.c,v retrieving revision 1.267 diff -u -p -r1.267 ldlang.c --- ld/ldlang.c 13 Jul 2007 07:34:25 -0000 1.267 +++ ld/ldlang.c 29 Jul 2007 02:52:28 -0000 @@ -1654,13 +1654,14 @@ lang_insert_orphan (asection *s, case lang_output_section_statement_enum: if (assign != NULL) where = assign; + break; case lang_input_statement_enum: case lang_address_statement_enum: case lang_target_statement_enum: case lang_output_statement_enum: case lang_group_statement_enum: case lang_afile_asection_pair_statement_enum: - break; + continue; } break; } Index: ld/emultempl/elf32.em =================================================================== RCS file: /cvs/src/src/ld/emultempl/elf32.em,v retrieving revision 1.183 diff -u -p -r1.183 elf32.em --- ld/emultempl/elf32.em 19 Jul 2007 19:56:10 -0000 1.183 +++ ld/emultempl/elf32.em 29 Jul 2007 02:52:30 -0000 @@ -1567,6 +1567,7 @@ output_rel_find (asection *sec, int isdy lang_output_section_statement_type *lookup; lang_output_section_statement_type *last = NULL; lang_output_section_statement_type *last_alloc = NULL; + lang_output_section_statement_type *last_ro_alloc = NULL; lang_output_section_statement_type *last_rel = NULL; lang_output_section_statement_type *last_rel_alloc = NULL; int rela = sec->name[4] == 'a'; @@ -1601,7 +1602,11 @@ output_rel_find (asection *sec, int isdy last = lookup; if (lookup->bfd_section != NULL && (lookup->bfd_section->flags & SEC_ALLOC) != 0) - last_alloc = lookup; + { + last_alloc = lookup; + if ((lookup->bfd_section->flags & SEC_READONLY) != 0) + last_ro_alloc = lookup; + } } if (last_rel_alloc) @@ -1610,6 +1615,9 @@ output_rel_find (asection *sec, int isdy if (last_rel) return last_rel; + if (last_ro_alloc) + return last_ro_alloc; + if (last_alloc) return last_alloc; Index: ld/testsuite/ld-elf/weak-dyn-1.rd =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-elf/weak-dyn-1.rd,v retrieving revision 1.1 diff -u -p -r1.1 weak-dyn-1.rd --- ld/testsuite/ld-elf/weak-dyn-1.rd 23 Jul 2007 09:56:19 -0000 1.1 +++ ld/testsuite/ld-elf/weak-dyn-1.rd 29 Jul 2007 08:17:42 -0000 @@ -1,3 +1,3 @@ #... -0+800000 .* foo.* +.* foo.* #pass -- Alan Modra Australia Development Lab, IBM