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]

Re: Quick --gc-sections question


On Mon, Nov 07, 2011 at 09:50:26PM +0100, Octoploid wrote:
> On Mon, Nov 7, 2011 at 9:13 PM, Ian Lance Taylor <iant@google.com> wrote:
> > I'll note that this was recently fixed in gold. ?If --export-dynamic is
> > passed to the linker, I think we should not garbage collect globally
> > visible functions.

Try this.

	* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in
	executables when export_dynamic.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.428
diff -u -p -r1.428 elflink.c
--- bfd/elflink.c	19 Oct 2011 07:17:19 -0000	1.428
+++ bfd/elflink.c	8 Nov 2011 05:31:11 -0000
@@ -11947,7 +11947,7 @@ bfd_elf_gc_mark_dynamic_ref_symbol (stru
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && (h->ref_dynamic
-	  || (!info->executable
+	  || ((!info->executable || info->export_dynamic)
 	      && h->def_regular
 	      && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
 	      && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN


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