From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12480 invoked by alias); 15 Oct 2002 00:08:11 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 12473 invoked from network); 15 Oct 2002 00:08:10 -0000 Received: from unknown (HELO mta03bw.bigpond.com) (139.134.6.86) by sources.redhat.com with SMTP; 15 Oct 2002 00:08:10 -0000 Received: from bubble.local ([144.135.24.69]) by mta03bw.bigpond.com (Netscape Messaging Server 4.15 mta03bw Jul 16 2002 22:47:55) with SMTP id H3ZXPG00.0OZ for ; Tue, 15 Oct 2002 10:08:04 +1000 Received: from CPE-144-136-184-138.sa.bigpond.net.au ([144.136.184.138]) by bwmam01.mailsvc.email.bigpond.com(MailRouter V3.0n 8/6400691); 15 Oct 2002 10:08:03 Received: (qmail 17562 invoked by uid 179); 15 Oct 2002 00:08:03 -0000 Date: Mon, 14 Oct 2002 17:08:00 -0000 From: Alan Modra To: binutils@sources.redhat.com Cc: Christian Biere Subject: ld -R and dynamic objects Message-ID: <20021015093803.H22176@bubble.sa.bigpond.net.au> Mail-Followup-To: binutils@sources.redhat.com, Christian Biere Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-SW-Source: 2002-10/txt/msg00343.txt.bz2 "ld --just-symbols" and dynamic objects don't mix very well. Prior to a stupid patch I made late yesterday, lang_place_orphans would abort on dynamic sections added in elf_link_add_object_symbols, and that's only the first place that gets seriously confused. I'm reverting the patch I made yesterday because it kills --just-symbols completely, proving that I shouldn't make even simple changes late at night. Instead, I'm inclined to just say "don't do that" by the following change to elflink.h. Results in $ ./ld-new -R /lib/libc.so.6 blah.o /lib/libc.so.6: could not read symbols: File format not recognized Comments? bfd/ChangeLog * elflink.h (elf_link_add_object_symbols): Error out on dynamic objects loaded with --just-symbols. ld/ChangeLog * ldlang.c (load_symbols): Revert last change. Index: bfd/elflink.h =================================================================== RCS file: /cvs/src/src/bfd/elflink.h,v retrieving revision 1.189 diff -u -p -r1.189 elflink.h --- bfd/elflink.h 11 Oct 2002 08:33:11 -0000 1.189 +++ bfd/elflink.h 14 Oct 2002 23:55:36 -0000 @@ -1299,6 +1299,13 @@ elf_link_add_object_symbols (abfd, info) bfd_size_type oldsize; bfd_size_type strindex; + /* ld --just-symbols and dynamic objects don't mix very well. + Test for --just-symbols by looking at info set up by + _bfd_elf_link_just_syms. */ + if ((s = abfd->sections) != NULL + && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) + goto error_return; + /* Find the name to use in a DT_NEEDED entry that refers to this object. If the object has a DT_SONAME entry, we use it. Otherwise, if the generic linker stuck something in Index: ld/ldlang.c =================================================================== RCS file: /cvs/src/src/ld/ldlang.c,v retrieving revision 1.101 diff -u -p -r1.101 ldlang.c --- ld/ldlang.c 14 Oct 2002 13:08:19 -0000 1.101 +++ ld/ldlang.c 14 Oct 2002 23:55:40 -0000 @@ -1590,9 +1590,7 @@ load_symbols (entry, place) break; } - if (entry->just_syms_flag) - entry->loaded = true; - else if (bfd_link_add_symbols (entry->the_bfd, &link_info)) + if (bfd_link_add_symbols (entry->the_bfd, &link_info)) entry->loaded = true; else einfo (_("%F%B: could not read symbols: %E\n"), entry->the_bfd); -- Alan Modra IBM OzLabs - Linux Technology Centre