[llvm-bugs] [Bug 30919] New: Clang compiled with static libcxx can't compile sanitized binaries
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 4 16:02:41 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30919
Bug ID: 30919
Summary: Clang compiled with static libcxx can't compile
sanitized binaries
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: aizatsky at chromium.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
I configure & compile clang with:
cmake -G "Ninja" \
-DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" \
ninja install
In this setup clang can compile normal programs, but can't compile sanitized
ones (ASAN):
echo -e "#include <stdio.h>\nint main() { printf(\"Hello\"); }" > hello.cc &&
clang++ -v -fsanitize=address -stdlib=libc++ -o hello hello.cc
Give the following:
clang version 4.0.0 (http://llvm.org/git/clang.git
80464680ce2ae47d30b9a404597643e5d8bf6bba) (http://llvm.org/git/llvm.git
3293f40456326902355f994d9672
1cd76ab91e01)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/local/bin/clang-4.0" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main
-file-name hello.cc -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -
fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/bin/../lib/clang/4.0.0 -internal-isystem /usr/lo
cal/bin/../include/c++/v1 -internal-isystem /usr/local/include
-internal-isystem /usr/local/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /u
sr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir / -fer
ror-limit 19 -fmessage-length 151 -fsanitize=address
-fsanitize-blacklist=/usr/local/bin/../lib/clang/4.0.0/asan_blacklist.txt
-fno-assume-sane-operato
r-new -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -o /tmp/hello-a213de.o -x c++ hello.cc
clang -cc1 version 4.0.0 based upon LLVM 4.0.0svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/bin/../include/c++/v1
/usr/local/include
/usr/local/bin/../lib/clang/4.0.0/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o hello
/usr/lib/gcc/x86_64-linux-gn
u/5.4.0/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/crtbe
gin.o -L/usr/lib/gcc/x86_64-linux-gnu/5.4.0
-L/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/
usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../..
-L/usr/local/bin/../lib -L/lib -L/usr/lib -whole-archive /usr/local/bin/../lib/
clang/4.0.0/lib/linux/libclang_rt.asan-x86_64.a -no-whole-archive
--dynamic-list=/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan-x86_64.a.
syms -whole-archive
/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a
-no-whole-archive --dynamic-list=/usr/local/bin/../lib/cl
ang/4.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a.syms /tmp/hello-a213de.o
-lc++ -lm --no-as-needed -lpthread -lrt -lm -ldl -lgcc_s -lgcc -lc -lgcc_s -
lgcc /usr/lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o
/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a(ubsan_type_hash_itanium.cc.o):
In function `isDerivedFromAtOffset(__cxxabiv1:
:__class_type_info const*, __cxxabiv1::__class_type_info const*, long) [clone
.constprop.0]':
/src/llvm/projects/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:120:
undefined reference to `typeinfo for __cxxabiv1::__si_class_type_info'
/src/llvm/projects/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:120:
undefined reference to `typeinfo for __cxxabiv1::__class_type_info'
/src/llvm/projects/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:126:
undefined reference to `__dynamic_cast'
/src/llvm/projects/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:130:
undefined reference to `typeinfo for __cxxabiv1::__vmi_class_type_info'
/src/llvm/projects/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:130:
undefined reference to `__dynamic_cast'
/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a(ubsan_type_hash_itanium.cc.o):
In function `isDerivedFromAtOffset':
/src/llvm/projects/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc:126:
undefined reference to `__dynamic_cast'
and so on.
For the reference, the output when clang is compiled in default mode:
clang version 4.0.0 (http://llvm.org/git/clang.git
80464680ce2ae47d30b9a404597643e5d8bf6bba) (http://llvm.org/git/llvm.git
f27a2d85ceca2978bafcaeb583b0ad9eb62a7f5f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/local/bin/clang-4.0" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name hello.cc -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info
-debugger-tuning=gdb -resource-dir /usr/local/bin/../lib/clang/4.0.0
-internal-isystem /usr/local/bin/../include/c++/v1 -internal-isystem
/usr/local/include -internal-isystem /usr/local/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length
151 -fsanitize=address
-fsanitize-blacklist=/usr/local/bin/../lib/clang/4.0.0/asan_blacklist.txt
-fno-assume-sane-operator-new -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -o /tmp/hello-364101.o -x c++ hello.cc
clang -cc1 version 4.0.0 based upon LLVM 4.0.0svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/bin/../include/c++/v1
/usr/local/include
/usr/local/bin/../lib/clang/4.0.0/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o hello
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/5.4.0
-L/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../.. -L/usr/local/bin/../lib -L/lib
-L/usr/lib -whole-archive
/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan-x86_64.a
-no-whole-archive
--dynamic-list=/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan-x86_64.a.syms
-whole-archive
/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a
-no-whole-archive
--dynamic-list=/usr/local/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a.syms
/tmp/hello-364101.o -lc++ -lm --no-as-needed -lpthread -lrt -lm -ldl -lgcc_s
-lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o
--
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/20161104/872d7222/attachment-0001.html>
More information about the llvm-bugs
mailing list