Issue Details (XML | Word | Printable)

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

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

"hidden" visibility does not work for external declaration

Created: 02/Nov/12 07:12 PM   Updated: 29/Apr/14 10:17 PM
Component/s: C frontend, Common code
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386

 Description  « Hide
The GCC attribute visibility("hidden") does not result in a .hidden directive in the assembler output for
a variable declared as external (but not defined)

The following example code shows the problem

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

int bar(void)
    return foo;

when compiled with pcc -S, it produces

        .align 4
        .globl bar
        .type bar,@function
        pushl %ebp
        movl %esp,%ebp
        subl $4,%esp
        movl foo,%eax
        movl %eax,-4(%ebp)
        jmp .L93
        movl -4(%ebp),%eax
        .size bar,.-bar
        .ident "PCC: pcc 1.1.0.DEVEL 20121101 for netbsd-i386"

whereas gcc produces something similar, but with a

       .hidden foo

directive so that the linker knows about it..

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 29/Apr/14 10:17 PM
.hidden outputted now.