[llvm-bugs] [Bug 49251] New: Undefined symbol with CFI and __attribute__((__used__))
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 18 11:37:37 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49251
Bug ID: 49251
Summary: Undefined symbol with CFI and
__attribute__((__used__))
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: tejohnson at google.com
Reporter: samitolvanen at google.com
CC: htmldeveloper at gmail.com, i at maskray.me,
llvm-bugs at lists.llvm.org, ndesaulniers at google.com,
peter at pcc.me.uk
Commit rG3c4c205060c9 ("[WPD][lld] Test handling of vtable definition from
shared libraries") breaks my Linux kernel build with ThinLTO and CFI, because
the compiler now generates an undefined symbol in a kernel module for a static
function with __attribute__((__used__)).
A stand-alone reproducer:
$ cat test.c
static __attribute__((__used__)) f1() {}
f2() {}
$ clang -flto=thin -fsanitize=cfi -fvisibility=default -O2 -c -o test.o test.c
...
$ ld.lld -r -o test.lto.o test.o
$ readelf --symbols test.lto.o | grep f1
9: 0000000000000000 1 FUNC GLOBAL HIDDEN 4
f1$0c315d2ea609b3d583650e385e8cf855
11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f1
Before this commit, the undefined symbol wasn't generated:
$ readelf --symbols test.lto.o | grep f1
9: 0000000000000000 1 FUNC GLOBAL HIDDEN 4
f1$0c315d2ea609b3d583650e385e8cf855
--
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/20210218/a088a2c6/attachment-0001.html>
More information about the llvm-bugs
mailing list