This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ld -R and dynamic objects


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]