Hi,
I’m trying to compile the example program from the DataFlow Sanitizer page (http://clang.llvm.org/docs/DataFlowSanitizer.html) without success. I receive a number of errors when trying to compile the example with clang:
/> clang -fsanitize=dataflow -o labelprop labelprop.c
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_info): relocation 19 has invalid symbol index 22
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/Scrt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/x86_64-linux-gnu/Scrt1.o: In function _start': (.text+0x20): undefined reference to
main’
/usr/local/llvm/build/Debug+Asserts/bin/…/lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(dfsan_interceptors.o): In function InitializeInterceptors': /usr/local/llvm/projects/compiler-rt/lib/dfsan/dfsan_interceptors.cc:40: undefined reference to
__interception::GetRealFunctionAddress(char const*, unsigned long*, unsigned long, unsigned long)’
/usr/local/llvm/projects/compiler-rt/lib/dfsan/dfsan_interceptors.cc:41: undefined reference to __interception::GetRealFunctionAddress(char const*, unsigned long*, unsigned long, unsigned long)' /usr/local/llvm/build/Debug+Asserts/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_deadlock_detector1.o):(.[data.rel.ro](http://data.rel.ro)+0x60): undefined reference to
vtable for __cxxabiv1::__si_class_type_info’
/usr/local/llvm/build/Debug+Asserts/bin/…/lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_deadlock_detector1.o):(.data.rel.ro._ZTIN11__sanitizer9DDetectorE[_ZTIN11__sanitizer9DDetectorE]+0x0): undefined reference to vtable for __cxxabiv1::__class_type_info' /usr/local/llvm/build/Debug+Asserts/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer.o):(.data.rel.ro._ZTIN11__sanitizer10SymbolizerE[_ZTIN11__sanitizer10SymbolizerE]+0x0): undefined reference to
vtable for __cxxabiv1::__class_type_info’
/usr/local/llvm/build/Debug+Asserts/bin/…/lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer_posix_libcdep.o):(.data.rel.ro._ZTIN11__sanitizer27ExternalSymbolizerInterfaceE[_ZTIN11__sanitizer27ExternalSymbolizerInterfaceE]+0x0): undefined reference to vtable for __cxxabiv1::__class_type_info' /usr/local/llvm/build/Debug+Asserts/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer_posix_libcdep.o):(.data.rel.ro._ZTIN11__sanitizer13Addr2LinePoolE[_ZTIN11__sanitizer13Addr2LinePoolE]+0x0): undefined reference to
vtable for __cxxabiv1::__si_class_type_info’
/usr/local/llvm/build/Debug+Asserts/bin/…/lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer_posix_libcdep.o):(.data.rel.ro._ZTIN11__sanitizer17SymbolizerProcessE[_ZTIN11__sanitizer17SymbolizerProcessE]+0x0): undefined reference to vtable for __cxxabiv1::__si_class_type_info' /usr/local/llvm/build/Debug+Asserts/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer_posix_libcdep.o):(.data.rel.ro._ZTIN11__sanitizer16Addr2LineProcessE[_ZTIN11__sanitizer16Addr2LineProcessE]+0x0): undefined reference to
vtable for __cxxabiv1::__si_class_type_info’
/usr/local/llvm/build/Debug+Asserts/bin/…/lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer_posix_libcdep.o):(.data.rel.ro._ZTIN11__sanitizer21LLVMSymbolizerProcessE[_ZTIN11__sanitizer21LLVMSymbolizerProcessE]+0x0): undefined reference to vtable for __cxxabiv1::__si_class_type_info' /usr/local/llvm/build/Debug+Asserts/bin/../lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_symbolizer_posix_libcdep.o):(.data.rel.ro._ZTIN11__sanitizer15POSIXSymbolizerE[_ZTIN11__sanitizer15POSIXSymbolizerE]+0x0): undefined reference to
vtable for __cxxabiv1::__si_class_type_info’
/usr/local/llvm/build/Debug+Asserts/bin/…/lib/clang/3.5.0/lib/linux/libclang_rt.dfsan-x86_64.a(sanitizer_thread_registry.o):(.data.rel.ro._ZTIN11__sanitizer17ThreadContextBaseE[_ZTIN11__sanitizer17ThreadContextBaseE]+0x0): undefined reference to vtable for __cxxabiv1::__class_type_info' /tmp/labelprop-bfe82e.o: In function
dfs$main’:
labelprop.c:(.text+0x78): undefined reference to dfs$dfsan_create_label' labelprop.c:(.text+0xcc): undefined reference to
dfs$dfsan_set_label’
labelprop.c:(.text+0x108): undefined reference to dfs$dfsan_create_label' labelprop.c:(.text+0x145): undefined reference to
dfs$dfsan_set_label’
labelprop.c:(.text+0x181): undefined reference to dfs$dfsan_create_label' labelprop.c:(.text+0x1bf): undefined reference to
dfs$dfsan_set_label’
labelprop.c:(.text+0x2c1): undefined reference to dfs$dfsan_get_label' labelprop.c:(.text+0x303): undefined reference to
dfs$dfsan_has_label’
labelprop.c:(.text+0x341): undefined reference to dfs$__assert_fail' labelprop.c:(.text+0x36c): undefined reference to
dfs$dfsan_has_label’
labelprop.c:(.text+0x3aa): undefined reference to dfs$__assert_fail' labelprop.c:(.text+0x3d5): undefined reference to
dfs$dfsan_has_label’
labelprop.c:(.text+0x413): undefined reference to dfs$__assert_fail' labelprop.c:(.text+0x5e2): undefined reference to
dfs$dfsan_get_label’
labelprop.c:(.text+0x624): undefined reference to dfs$dfsan_has_label' labelprop.c:(.text+0x662): undefined reference to
dfs$__assert_fail’
labelprop.c:(.text+0x68d): undefined reference to dfs$dfsan_has_label' labelprop.c:(.text+0x6cb): undefined reference to
dfs$__assert_fail’
labelprop.c:(.text+0x6f6): undefined reference to dfs$dfsan_has_label' labelprop.c:(.text+0x734): undefined reference to
dfs$__assert_fail’
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also tried to use the prepackaged distribution of clang/llvm for Ubuntu and obtained the same error.
I’m running on Ubuntu Trusty, gcc 4.8.2 and I specified -fsanitize=dataflow when compiling with clang.
Anything wrong? Any help will be appreciated!
Thanks,
Frederico