<< Back to previous view

[PCC-412] "hidden" visibility does not work for external declaration Created: 02/Nov/12  Updated: 29/Apr/14

Status: Resolved
Project: pcc
Component/s: C frontend, Common code
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Iain Hibbert Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: NetBSD/i386


 Description   
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..

 Comments   
Comment by Anders Magnusson [ 29/Apr/14 10:17 PM ]
.hidden outputted now.
Generated at Thu Dec 18 08:25:17 CET 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.