Fix localization of comdats

Message ID 20190209220136.372lqazt3qo36uix@kam.mff.cuni.cz
State New
Headers show
Series
  • Fix localization of comdats
Related show

Commit Message

Jan Hubicka Feb. 9, 2019, 10:01 p.m.
Hi,
this patch fixes undefined symbols when COMDAT group contains some
symbols with LDPR_PREVAILING_DEF_IRONLY_EXP and others with
LDPR_PREVIALING_DEF.  In this case we can not optimized out the
symbol defined LDPR_PREVAILING_DEF because it will be used by linker
for second stage linking.

We can still break-up the comdat and privatize
LDPR_PREVAILING_DEF_IRONLY_EXP symbols knowing that address is not taken
and duplication of these symbols within shared libraries is safe.

Bootstrapped/regtested x86_64-linux. Comitted.

Honza

	* ipa-visibility.c (localize_node): Also do not localize
	LDPR_PREVAILING_DEF_IRONLY_EXP.

Patch

Index: ipa-visibility.c
===================================================================
--- ipa-visibility.c	(revision 268722)
+++ ipa-visibility.c	(working copy)
@@ -539,7 +539,8 @@  localize_node (bool whole_program, symta
      symbols.  In this case we can privatize all hidden symbol but we need
      to keep non-hidden exported.  */
   if (node->same_comdat_group
-      && node->resolution == LDPR_PREVAILING_DEF_IRONLY)
+      && (node->resolution == LDPR_PREVAILING_DEF_IRONLY
+	  || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP))
     {
       symtab_node *next;
       for (next = node->same_comdat_group;