i386.h (ix86_expand_prologue): Do not emit pic register load if "internal" visibility.

* 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
This commit is contained in:
Richard Henderson 2002-03-02 21:20:04 -08:00 committed by Richard Henderson
parent b3bbd220ea
commit 9e8aab55f6
3 changed files with 38 additions and 1 deletions

View 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

View 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

View 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})