Bug 85692 - Visibility reference doesn't work.
Summary: Visibility reference doesn't work.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL: http://www.caldera.com/developers/gab...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-03-06 00:49 UTC by hjl
Modified: 2007-04-18 16:51 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-10-03 12:41:29 UTC
Embargoed:


Attachments (Terms of Use)

Description hjl 2003-03-06 00:49:21 UTC
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 22:25:03 UTC
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-10 00:37:24 UTC
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 19:12:11 UTC
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.