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]

--gc-sections vs linkonce sections


I found this mismatch in reference counting when testing --gc-sections
on dynamic executables.  Symptom is unresolvable relocs when plt
refcount goes to zero.

bfd/
	* elflink.c (elf_gc_sweep): Do not refcount on sections that have
	not been processed by check_relocs.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.168
diff -u -p -r1.168 elflink.c
--- bfd/elflink.c	14 Jun 2005 19:25:45 -0000	1.168
+++ bfd/elflink.c	29 Jun 2005 13:02:15 -0000
@@ -8902,7 +8941,9 @@ elf_gc_sweep (struct bfd_link_info *info
 	  /* But we also have to update some of the relocation
 	     info we collected before.  */
 	  if (gc_sweep_hook
-	      && (o->flags & SEC_RELOC) && o->reloc_count > 0)
+	      && (o->flags & SEC_RELOC) != 0
+	      && o->reloc_count > 0
+	      && !bfd_is_abs_section (o->output_section))
 	    {
 	      Elf_Internal_Rela *internal_relocs;
 	      bfd_boolean r;

-- 
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]