51f0aa
commit e0ed2fb40a0e29c43cf60addc74741dab15f2e05
51f0aa
Author: H.J. Lu <hjl.tools@gmail.com>
51f0aa
Date:   Fri Mar 6 04:55:56 2015 -0800
51f0aa
51f0aa
    Replace __attribute__((visibility("protected")))
51f0aa
    
51f0aa
    With copy relocation, address of protected data defined in the shared
51f0aa
    library may be external.  Compiler shouldn't asssume protected data will
51f0aa
    be local.  But due to
51f0aa
    
51f0aa
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
51f0aa
    
51f0aa
    __attribute__((visibility("protected"))) doesn't work correctly, we need
51f0aa
    to use asm (".protected xxx") instead.
51f0aa
    
51f0aa
            * elf/ifuncdep2.c (global): Replace
51f0aa
            __attribute__((visibility("protected"))) with
51f0aa
            asm (".protected global").
51f0aa
            * elf/ifuncmod1.c (global): Likewise.
51f0aa
            * elf/ifuncmod5.c (global): Likewise.
51f0aa
51f0aa
Index: b/elf/ifuncdep2.c
51f0aa
===================================================================
51f0aa
--- a/elf/ifuncdep2.c
51f0aa
+++ b/elf/ifuncdep2.c
51f0aa
@@ -2,7 +2,13 @@
51f0aa
 
51f0aa
 #include "ifunc-sel.h"
51f0aa
 
51f0aa
-int global __attribute__ ((visibility ("protected"))) = -1;
51f0aa
+int global = -1;
51f0aa
+/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
51f0aa
+
51f0aa
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
51f0aa
+
51f0aa
+   is fixed.  */
51f0aa
+asm (".protected global");
51f0aa
 
51f0aa
 static int
51f0aa
 one (void)
51f0aa
Index: b/elf/ifuncmod1.c
51f0aa
===================================================================
51f0aa
--- a/elf/ifuncmod1.c
51f0aa
+++ b/elf/ifuncmod1.c
51f0aa
@@ -6,7 +6,13 @@
51f0aa
  */
51f0aa
 #include "ifunc-sel.h"
51f0aa
 
51f0aa
-int global __attribute__ ((visibility ("protected"))) = -1;
51f0aa
+int global = -1;
51f0aa
+/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
51f0aa
+
51f0aa
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
51f0aa
+
51f0aa
+   is fixed.  */
51f0aa
+asm (".protected global");
51f0aa
 
51f0aa
 static int
51f0aa
 one (void)
51f0aa
Index: b/elf/ifuncmod5.c
51f0aa
===================================================================
51f0aa
--- a/elf/ifuncmod5.c
51f0aa
+++ b/elf/ifuncmod5.c
51f0aa
@@ -1,7 +1,13 @@
51f0aa
 /* Test STT_GNU_IFUNC symbols without direct function call.  */
51f0aa
 #include "ifunc-sel.h"
51f0aa
 
51f0aa
-int global __attribute__ ((visibility ("protected"))) = -1;
51f0aa
+int global = -1;
51f0aa
+/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
51f0aa
+
51f0aa
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
51f0aa
+
51f0aa
+   is fixed.  */
51f0aa
+asm (".protected global");
51f0aa
 
51f0aa
 static int
51f0aa
 one (void)