Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 653486 - sys-devel/clang -fsanitize=address: undefined reference to '_Unwind_GetIP'
Summary: sys-devel/clang -fsanitize=address: undefined reference to '_Unwind_GetIP'
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-18 16:48 UTC by Alex Xu (Hello71)
Modified: 2018-04-20 01:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Xu (Hello71) 2018-04-18 16:48:35 UTC
latest versions of all llvm/clang/compiler-rt packages.

$ cat test.c
#include <stdlib.h>
#include <stdio.h>
int main() {
    printf("%p\n", malloc(5));
    return 0;
}

$ clang test.c -fsanitize=address
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_GetIP'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_GetIP'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_Backtrace'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_Backtrace'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

$ clang test.c -fsanitize=address -lunwind
$ ./a.out
0x602000000010

=================================================================
==[pid]==ERROR: LeakSanitizer: detected memory leaks

(etc)
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-04-18 17:27:36 UTC
USE flags for all the relevant packages, please.
Comment 2 Alex Xu (Hello71) 2018-04-18 22:18:07 UTC
$ emerge -pqv llvm compiler-rt compiler-rt-sanitizers libcxx libcxxabi clang clang-common clang-runtime
[binary   R   ] sys-libs/compiler-rt-6.0.0  USE="clang {-test}" 
[binary   R   ] sys-libs/compiler-rt-sanitizers-6.0.0  USE="clang {-test}" 
[binary   R   ] sys-libs/libcxxabi-6.0.0  USE="libunwind static-libs {-test}" ABI_X86="(64) -32 (-x32)" 
[binary   R   ] sys-devel/clang-runtime-6.0.0-r1  USE="compiler-rt openmp sanitize -crt -libcxx" ABI_X86="(64) -32 (-x32)" 
[binary   R   ] sys-devel/llvm-6.0.0  USE="gold libffi -debug -doc -libedit -ncurses {-test} -xar -xml" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="AMDGPU (X86) -AArch64 -ARM -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore" 
[binary   R   ] sys-libs/libcxx-6.0.0  USE="libcxxabi libunwind static-libs -libcxxrt {-test}" ABI_X86="(64) -32 (-x32)" 
[binary   R   ] sys-devel/clang-6.0.0-r1  USE="default-compiler-rt default-libcxx static-analyzer -debug -doc {-test} -xml (-z3)" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="AMDGPU (X86) -AArch64 -ARM -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore" PYTHON_TARGETS="python2_7" 
[binary   R   ] sys-devel/clang-common-6.0.0
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-04-19 04:41:29 UTC
Could you also paste verbose clang output (i.e. 'clang -v ...')?
Comment 4 Alex Xu (Hello71) 2018-04-20 01:20:42 UTC
$ clang -fsanitize=address -v -x c /dev/null
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/6/bin
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/usr/lib/llvm/6/bin/clang-6.0" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name null -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 273 -fsanitize=address -fsanitize-blacklist=/usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/asan_blacklist.txt -fsanitize-address-use-after-scope -fno-assume-sane-operator-new -fobjc-runtime=gcc -fdiagnostics-show-option -o /tmp/null-6233be.o -x c /dev/null
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/include
 /usr/include
End of search list.
 "/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib64 -L/usr/lib/llvm/6/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../.. -L/usr/lib/llvm/6/bin/../lib -L/lib -L/usr/lib -whole-archive /usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/lib/linux/libclang_rt.asan-x86_64.a -no-whole-archive --dynamic-list=/usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/lib/linux/libclang_rt.asan-x86_64.a.syms /tmp/null-6233be.o --no-as-needed -lpthread -lrt -lm -ldl /usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/lib/linux/libclang_rt.builtins-x86_64.a -lc /usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0/lib/linux/libclang_rt.builtins-x86_64.a /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib64/crtn.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../lib64/crt1.o:function _start: error: undefined reference to 'main'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_GetIP'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_GetIP'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_Backtrace'
/tmp/portage/sys-libs/compiler-rt-sanitizers-6.0.0/work/compiler-rt-6.0.0.src/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:91: error: undefined reference to '_Unwind_Backtrace'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)