[llvm-bugs] [Bug 39236] New: Static locals in inline functions should be hidden with -fvisibility=hidden and -fvisibility-inlines-hidden
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 9 14:34:47 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39236
Bug ID: 39236
Summary: Static locals in inline functions should be hidden
with -fvisibility=hidden and
-fvisibility-inlines-hidden
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: rnk at google.com
CC: hans at chromium.org, inouehrs at jp.ibm.com,
llvm-bugs at lists.llvm.org
This is a bug in the fix to https://llvm.org/pr37595, or r340386.
We encountered it in Chromium here: https://crbug.com/891992#c20
This probably isn't too hard to fix.
Pasting Hans's reproducer below:
Yes, it seems Clang and GCC behave differently here:
inline int foo() {
static int x;
return x++;
}
int use() { return foo(); }
$ g++ -fvisibility=hidden -fvisibility-inlines-hidden -c /tmp/a.cc && objdump
-t a.o
a.o: file format elf64-x86-64
SYMBOL TABLE:
0000000000000000 l df *ABS* 0000000000000000 a.cc
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .data 0000000000000000 .data
0000000000000000 l d .bss 0000000000000000 .bss
0000000000000000 l d .bss._ZZ3foovE1x 0000000000000000
.bss._ZZ3foovE1x
0000000000000000 l d .text._Z3foov 0000000000000000 .text._Z3foov
0000000000000000 l d .note.GNU-stack 0000000000000000
.note.GNU-stack
0000000000000000 l d .eh_frame 0000000000000000 .eh_frame
0000000000000000 l d .comment 0000000000000000 .comment
0000000000000000 l d .group 0000000000000000 .group
0000000000000000 l d .group 0000000000000000 .group
0000000000000000 u O .bss._ZZ3foovE1x 0000000000000004 .hidden
_ZZ3foovE1x <---- foo()::x is hidden
0000000000000000 w F .text._Z3foov 0000000000000015 .hidden _Z3foov
0000000000000000 g F .text 000000000000000b .hidden _Z3usev
$ clang++ -fvisibility=hidden -fvisibility-inlines-hidden -c /tmp/a.cc &&
objdump -t a.o
a.o: file format elf64-x86-64
SYMBOL TABLE:
0000000000000000 l df *ABS* 0000000000000000 a.cc
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .text._Z3foov 0000000000000000 .text._Z3foov
0000000000000000 w F .text._Z3foov 0000000000000019 .hidden _Z3foov
0000000000000000 g F .text 000000000000000b .hidden _Z3usev
0000000000000000 w O .bss._ZZ3foovE1x 0000000000000004 _ZZ3foovE1x
<----- foo()::x is not hidden
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181009/c4156e14/attachment.html>
More information about the llvm-bugs
mailing list