This is the mail archive of the binutils@sourceware.org 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]

Fix PR 12772, garbage collection of dynamic syms


My PR 13177 fix marked all symbols used by relocs, so that we could
remove unnecessary undefined dynamic symbols.  Symbols defined in the
output binary need to be kept, regardless of whether they are used by
relocs or not, unless they were defined in a section that was garbage
collected.  What I missed was that symbols defined somewhere other
than the output binary, eg. symbols in shared libraries, should be
treated just like undefined symbols.

	PR ld/12772
	* elflink.c (elf_gc_sweep_symbol): Discard unmarked symbols
	defined in shared libraries.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.431
diff -u -p -r1.431 elflink.c
--- bfd/elflink.c	3 Dec 2011 10:29:01 -0000	1.431
+++ bfd/elflink.c	7 Dec 2011 06:24:08 -0000
@@ -11725,7 +11725,8 @@ elf_gc_sweep_symbol (struct elf_link_has
   if (!h->mark
       && (((h->root.type == bfd_link_hash_defined
 	    || h->root.type == bfd_link_hash_defweak)
-	   && !h->root.u.def.section->gc_mark)
+	   && !(h->def_regular
+		&& h->root.u.def.section->gc_mark))
 	  || h->root.type == bfd_link_hash_undefined
 	  || h->root.type == bfd_link_hash_undefweak))
     {

-- 
Alan Modra
Australia Development Lab, IBM


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