Bug 70019 - attribute ((visibility("internal"))) is not valid on static functions
attribute ((visibility("internal"))) is not valid on static functions
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-07-29 00:07 EDT by James Antill
Modified: 2007-04-18 12:44 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-02 19:45:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description James Antill 2002-07-29 00:07:37 EDT
Description of Problem:
 If you have a function that is only used as the helper function of a symbol
exported from a shared library, then the traditional appraoch would be to
declare the symbol static -- giving it file scope and removing it from the ABI
of the library. However this is only visibility=hidden, as far as the compiler
understands it (as you could use that function in a function ptr etc.)
 This means that if you declare the function "extern" with attribute
visibility=internal the compiler will generate better code.

Version-Release number of selected component (if applicable):

How Reproducible:

Steps to Reproduce:
1. Add an visibility("internal") attribute to a static function.

Actual Results:
 The compiler gives a "`visibility' attribute ignored" warning.

Expected Results:
 The compiler obeys the attribute just as if it was an extern declaration.

Additional Information:
Comment 1 Richard Henderson 2004-10-02 19:45:26 EDT
No, using "static" is the absolute best you can tell the compiler.
Even better than visibility=internal (which, incidentally, the compiler
does nothing special with at present).  It means that all references
to the symbol are visible in the current translation unit.

Visibility attributes are not applicable to STB_LOCAL symbols, so the
compiler is right to complain.

Note You need to log in before you can comment on or make changes to this bug.