[LLVMbugs] [Bug 8383] New: #pragma weak does not honor visibility
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Thu Oct 14 16:42:40 PDT 2010
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=8383
           Summary: #pragma weak does not honor visibility
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jed at 59a2.org
                CC: llvmbugs at cs.uiuc.edu
$ cat weak.c
#define EXPORT __attribute((visibility("default")))
extern int EXPORT foo_a(void);
extern int EXPORT foo_b(void);
extern int EXPORT foo_c(void);
#pragma weak foo_a = foo_c
int foo_b(void) __attribute((weak, alias(("foo_c"))));
int foo_c(void) { return 0; }
$ clang -shared -fvisibility=hidden weak.c -o libweak.so && nm -D libweak.so |
grep foo
0000000000000550 W foo_b
0000000000000550 T foo_c
$ gcc -shared -fvisibility=hidden weak.c -o libweak.so && nm -D libweak.so |
grep foo
000000000000055c W foo_a
000000000000055c W foo_b
000000000000055c T foo_c
The visibility of the symbol "foo_a" is not respected, but the pragma is
clearly supported because the following works as expected.
$ clang -shared -fvisibility=default weak.c -o libweak.so && nm -D libweak.so |
grep foo
0000000000000580 W foo_a
0000000000000580 W foo_b
0000000000000580 T foo_c
$ clang --version
clang version 2.8 (branches/release_28)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ uname -a
Linux kunyang 2.6.35-ARCH #1 SMP PREEMPT Wed Sep 29 08:45:18 CEST 2010 x86_64
Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz GenuineIntel GNU/Linux
-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
    
    
More information about the llvm-bugs
mailing list