This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Binutils gc-sections
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Ivan Petrov <petrov at mail dot mobyline dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Sat, 10 Dec 2005 14:06:21 +1030
- Subject: Re: Binutils gc-sections
- References: <000601c5fd0f$1bf70f00$6401a8c0@HARMMOB>
On Sat, Dec 10, 2005 at 03:22:55AM +0500, Ivan Petrov wrote:
> Hi!
>
> Now i see on you patches for BinUtils... and have few ideas about
> elf_gc_mark_dynamic_ref_symbol.
> It not right mark all externaly visibled dynamic symbols as SEC_KEEP.
>
> Realy we must put 'dynamic' sections as child for CODE or DATA section.
> i.e. make forwarded link.
> in this case we will have right graph, and also posible remove restriction
> '-r' and '--gc-sections' together.
Thanks, your testcase showed me the real problem. BTW, it is usually
better to ask questions or discuss patches on public mailing lists. See
http://www.eyrie.org/~eagle/faqs/questions.html
* elflink.c (elf_gc_mark_dynamic_ref_symbol): Use !info-executable
to test for linking shared libs, not info->shared.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.198
diff -u -p -r1.198 elflink.c
--- bfd/elflink.c 7 Dec 2005 14:43:53 -0000 1.198
+++ bfd/elflink.c 10 Dec 2005 03:25:48 -0000
@@ -9068,7 +9075,7 @@ elf_gc_mark_dynamic_ref_symbol (struct e
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->ref_dynamic
- || (info->shared
+ || (!info->executable
&& h->def_regular
&& ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN)))
--
Alan Modra
IBM OzLabs - Linux Technology Centre