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: PATCH: PR ld/13229: V2 of getsymbol linker plugin interface is not supported by GNU LD


On Fri, Oct 07, 2011 at 09:45:31AM -0700, H.J. Lu wrote:
> When a plugin symbol is optimized out by linker plugin, we shouldn't
> put it in symbol table for non-relocatable link.  OK for trunk?

Not without some explanation.  Please describe how the existing code
is failing, and why ignoring the h->indx test will not cause later
problems.

Hmm, I do see a bug here, fixed as follows.

	* elflink.c (elf_link_output_extsym): Strip defined plugin symbols
	even when strip_discarded is false.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.422
diff -u -p -r1.422 elflink.c
--- bfd/elflink.c	29 Sep 2011 05:40:21 -0000	1.422
+++ bfd/elflink.c	7 Oct 2011 22:59:38 -0000
@@ -8679,10 +8679,12 @@ elf_link_output_extsym (struct bfd_hash_
 	   && bfd_hash_lookup (finfo->info->keep_hash,
 			       h->root.root.string, FALSE, FALSE) == NULL)
     strip = TRUE;
-  else if (finfo->info->strip_discarded
-	   && (h->root.type == bfd_link_hash_defined
-	       || h->root.type == bfd_link_hash_defweak)
-	   && elf_discarded_section (h->root.u.def.section))
+  else if ((h->root.type == bfd_link_hash_defined
+	    || h->root.type == bfd_link_hash_defweak)
+	   && ((finfo->info->strip_discarded
+		&& elf_discarded_section (h->root.u.def.section))
+	       || (h->root.u.def.section->owner != NULL
+		   && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0)))
     strip = TRUE;
   else if ((h->root.type == bfd_link_hash_undefined
 	    || h->root.type == bfd_link_hash_undefweak)

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