Fix localization of comdats

Message ID
State New
Headers show
  • Fix localization of comdats
Related show

Commit Message

Jan Hubicka Feb. 9, 2019, 10:01 p.m.
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.


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


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;