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

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

Comment by Anders Magnusson [ 29/Apr/14 10:17 PM ]
.hidden outputted now.
Generated at Sat Oct 21 08:36:09 CEST 2017 using JIRA Enterprise Edition, Version: 3.13.1-#333.