<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Clang compiled with static libcxx can't compile sanitized binaries"
href="https://llvm.org/bugs/show_bug.cgi?id=30919">30919</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang compiled with static libcxx can't compile sanitized binaries
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>aizatsky@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
80464680ce2ae47d30b9a404597643e5d8bf6bba) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
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 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
80464680ce2ae47d30b9a404597643e5d8bf6bba) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>