i386.h (ix86_expand_prologue): Do not emit pic register load if "internal" visibility.
authorRichard Henderson <rth@redhat.com>
Sun, 3 Mar 2002 05:20:04 +0000 (21:20 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 3 Mar 2002 05:20:04 +0000 (21:20 -0800)
        * config/i386/i386.h (ix86_expand_prologue): Do not emit pic register
        load if "internal" visibility.
        * doc/extend.texi: Document visibility meanings.

From-SVN: r50240

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/doc/extend.texi

index 5e6504db49b8545e4b0b38064eb3acd607794ef7..3f70e67d95e62154ba0f975b96a0983d17e7b06f 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-02  Richard Henderson  <rth@redhat.com>
+
+       * config/i386/i386.h (ix86_expand_prologue): Do not emit pic register
+       load if "internal" visibility.
+       * doc/extend.texi: Document visibility meanings.
+
 2002-03-02  Richard Henderson  <rth@redhat.com>
 
        * config/i386/i386.h (ENCODE_SECTION_INFO): MODULE_LOCAL_P applies
index 0a354d666771f4156d77cbce2ef295eda09d8318..11c128c3689c7ce8d555589b371ed9c498c16c5b 100644 (file)
@@ -4184,7 +4184,13 @@ ix86_expand_prologue ()
 #endif
 
   if (pic_reg_used)
-    load_pic_register ();
+    {
+      tree vis = lookup_attribute ("visibility", DECL_ATTRIBUTES (cfun->decl));
+      if (!vis
+         || strcmp ("internal",
+                    TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (vis)))))
+        load_pic_register ();
+    }
 
   /* If we are profiling, make sure no instructions are scheduled before
      the call to mcount.  However, if -fpic, the above call will have
index 96db4ad944e16f817eadfdab4eb6bf2a96c1dde8..59297d257a553ab32f96cacdbe24e9dcb3095e50 100644 (file)
@@ -2218,6 +2218,31 @@ f () @{ /* @r{Do something.} */; @}
 int i __attribute__ ((visibility ("hidden")));
 @end smallexample
 
+See the ELF gABI for complete details, but the short story is
+
+@table @dfn
+@item hidden
+Hidden visibility indicates that the symbol will not be placed into
+the dynamic symbol table, so no other @dfn{module} (executable or
+shared library) can reference it directly.
+
+@item protected
+Protected visibility indicates that the symbol will be placed in the
+dynamic symbol table, but that references within the defining module
+will bind to the local symbol.  That is, the symbol cannot be overridden
+by another module.
+
+@item internal
+Internal visibility is like hidden visibility, but with additional
+processor specific semantics.  Unless otherwise specified by the psABI,
+gcc defines internal visibility to mean that the function is @emph{never}
+called from another module.  Note that hidden symbols, while then cannot
+be referenced directly by other modules, can be referenced indirectly via
+function pointers.  By indicating that a symbol cannot be called from
+outside the module, gcc may for instance omit the load of a PIC register
+since it is known that the calling function loaded the correct value.
+@end table
+
 Not all ELF targets support this attribute.
 
 @item regparm (@var{number})