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
to functions as well.
#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
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})