Issue Details (XML | Word | Printable)

Key: PCC-423
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 are not referenced correctly when using -fPIC

Created: 30/Apr/14 11:11 PM   Updated: 01/May/14 01:01 PM
Component/s: C frontend, Common code, i386 target
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
a hidden object is not referenced correctly when using -fPIC compilation mode. The following code illustrates this

extern int foo0 __attribute__((__visibility__("hidden")));
extern int foo1;

int bar(void)
{
        return foo0 + foo1;
}

when compiled with "pcc -fPIC -S test.c" handles a reference to the _GLOBAL_OFFSET_TABLE_, but does not use it for foo0

        movl foo1@GOT(%eax),%edx
        movl foo0,%eax

contrast this with gcc output, which produces

        addl $_GLOBAL_OFFSET_TABLE_, %ecx
        movl foo0@GOTOFF(%ecx), %edx
        movl foo1@GOT(%ecx), %eax

anyway, this causes errors down the line, in the linking part of libraries which are using hidden symbols.





 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson made changes - 01/May/14 01:01 PM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
Anders Magnusson added a comment - 01/May/14 01:01 PM
Now i386 outputs hidden vars @GOTOFF instead of nothing.

Anders Magnusson made changes - 01/May/14 01:01 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]