Bug 85692 - Visibility reference doesn't work.
Visibility reference doesn't work.
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
http://www.caldera.com/developers/gab...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-03-05 19:49 EST by hjl
Modified: 2007-04-18 12:51 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-03 08:41:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description hjl 2003-03-05 19:49:21 EST
According to gABI:

First, all of the non-default visibility attributes, when applied to a symbol 
reference, imply that a definition to satisfy that reference must be provided 
within the current executable or shared object. If such a symbol reference has 
no definition within the component being linked, then the reference must have 
STB_WEAK binding and is resolved to zero. 

it is ok to have

extern int short_hidden_ref_norm_def __attribute__ ((visibility ("hidden")));

int main()
{
  printf ("%d\n", short_hidden_ref_norm_def);
  return 0;
}

But gcc 3.2.1-7 doesn't make short_hidden_ref_norm_def as hidden.
Comment 1 Jakub Jelinek 2003-03-09 17:25:03 EST
That's on purpose. When you use visibility attribute on an external, you
guarantee that either you use the same attribute on the symbol definition,
or that you make the symbol .hidden in some other way (e.g. in assembly).
Initially, visibility attribute added .hidden even for external references,
but that created more problems than it was worth, so it was changed this way.
Comment 2 hjl 2003-03-09 19:37:24 EST
I believe the bug is in ld, not gcc. I am working on ld
to make it compliant to gABI. Right now, ld doesn't follow
gABI.
Comment 3 hjl 2003-05-15 15:12:11 EDT
The gABI allows weak undefined hidden/protected symbols.
Visibility information may also help linker. Gcc emits
weak undefined symbols. I think it should do the same for
hidden/protected symbols.

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