public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld -R and dynamic objects
@ 2002-10-14 17:08 Alan Modra
  2002-10-15 18:02 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2002-10-14 17:08 UTC (permalink / raw)
  To: binutils; +Cc: Christian Biere

"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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ld -R and dynamic objects
  2002-10-14 17:08 ld -R and dynamic objects Alan Modra
@ 2002-10-15 18:02 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2002-10-15 18:02 UTC (permalink / raw)
  To: binutils, Christian Biere

On Tue, Oct 15, 2002 at 09:38:03AM +0930, Alan Modra wrote:
> 	* elflink.h (elf_link_add_object_symbols): Error out on dynamic objects
> 	loaded with --just-symbols.

Committed.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-16  1:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-14 17:08 ld -R and dynamic objects Alan Modra
2002-10-15 18:02 ` Alan Modra

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).