This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
--gc-sections vs linkonce sections
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Wed, 29 Jun 2005 23:14:21 +0930
- Subject: --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