Issue Details (XML | Word | Printable)

Key: PCC-424
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

hidden objects emit a reference when not used

Created: 05/May/14 08:16 PM   Updated: 07/May/14 07:03 PM
Component/s: C frontend, i386 target
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
when using the "hidden" attribute on an object, a .hidden assembler stub is emitted.. but this should only happen
for objects which are used, otherwise the linker has trouble with linking

for example, the following code which is similare to code used to create shared libraries:

int foo (void) __attribute__ ((__visibility__("hidden")));

int bar (void)
{
        return 1;
}

when compiled with "pcc -shared test.c -o test.lib", emits the following failure:

ld: test.lib: hidden symbol `foo' isn't defined
ld: final link failed: Bad value
ld terminated with status 1

this is because the assembler has translated the ".hidden foo" line into an undefined reference



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 07/May/14 07:03 PM
Now .hidden is only emitted if the symbol is referenced.
This may fail if the reference gets optimized away in pass2, but handle that problem then.