This is the mail archive of the 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 --gc-sections and shared libs built with -q

This cures a linker segfault found when running the gcc testsuite
against built with --emit-relocations.  There isn't any
reason to look into dynamic library relocations (normally there aren't
any non-dynamic ones for --gc-sections to look at), and if we do, ld
uses the wrong symbol table.


	* elflink.c (_bfd_elf_gc_mark_reloc): Don't delve into dynamic

Index: bfd/elflink.c
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.434
diff -u -p -r1.434 elflink.c
--- bfd/elflink.c	23 Mar 2012 09:27:43 -0000	1.434
+++ bfd/elflink.c	29 Mar 2012 22:53:42 -0000
@@ -11590,7 +11590,8 @@ _bfd_elf_gc_mark_reloc (struct bfd_link_
   rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
   if (rsec && !rsec->gc_mark)
-      if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
+      if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour
+	  || (rsec->owner->flags & DYNAMIC) != 0)
 	rsec->gc_mark = 1;
       else if (!_bfd_elf_gc_mark (info, rsec, gc_mark_hook))
 	return FALSE;

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]