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
Operations

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

"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

        .text
        .align 4
        .globl bar
        .type bar,@function
bar:
        pushl %ebp
        movl %esp,%ebp
        subl $4,%esp
.L92:
.L94:
        movl foo,%eax
        movl %eax,-4(%ebp)
        jmp .L93
.L93:
        movl -4(%ebp),%eax
        leave
        ret
        .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 made changes - 29/Apr/14 10:17 PM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
Anders Magnusson made changes - 29/Apr/14 10:17 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]