[llvm-bugs] [Bug 34966] New: Missing static function with thinlto on AArch64 when an extern function with same name exists.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 16 11:08:17 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34966
Bug ID: 34966
Summary: Missing static function with thinlto on AArch64 when
an extern function with same name exists.
Product: tools
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: lto
Assignee: unassignedbugs at nondot.org
Reporter: hiraditya at msn.com
CC: llvm-bugs at lists.llvm.org
The static/internal function with thinlto gets skipped and results in a
miscompile. A reduced test case is as follows:
$cat static.c
static int __attribute__((__noinline__)) f(int i) {
volatile int j = i+10;
return j;
}
int ext() {
return f(100);
}
$ cat non-static.c
int f(void) { return 32; }
$ cat reference.c
int f();
int ext();
int main(void) {
return f()+ ext();
}
$ cat run.sh
CC=~/llvm/build/bin/clang
LARGS=~/llvm/build/lib/libLTO.dylib
LFLAGS='-fobjc-arc -Xlinker -lto_library -Xlinker'
CFLAGS='--save-temps -v -Xlinker -save-temps'
ARCH='-arch arm64 -isysroot
/Applications/Xcode_9.0.0_fb.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk'
$CC -Oz -flto=thin static.c non-static.c reference.c $ARCH $CFLAGS $LFLAGS
$LARGS
Only one function '_f' is there and the static function 'f' is gone.
$ objdump -d a.out | grep _.*
Disassembly of section __TEXT,__text:
__text:
_ext:
_f:
_main:
However, when you target x86_64 (just remove the ARGS from command line)
$ objdump -d a.out | grep ^_.*
__text:
_ext:
_f.llvm.4247299495:
_f:
_main:
--
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/20171016/d7099e98/attachment.html>
More information about the llvm-bugs
mailing list