[cfe-dev] How to configure an autools project with Clang sanitizers library?
Frederico Araujo
araujof at gmail.com
Thu May 22 15:45:55 PDT 2014
Hi,
I've tried to compile Apache Httpd (and several other open source projects)
with clang using the dataflow sanitizer. I set the CC environment variable
to point to my clang installation and I specified the "-fsanitize=dataflow"
in the CFLAGS and/or LDFLAGS environment variables.
However, the configure script fails when running its C compiler tests (in
Apache's case, the first problem occurs for the APR library). The following
is an excerpt of the config.log output:
(...)
configure:5409: checking whether the C compiler works
configure:5431: /usr/local/llvm/build/Debug+Asserts/bin/clang
-fsanitize=dataflow conftest.c >&5
/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/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)'
(...)(.data.rel.ro._ZTIN11__sanitizer17ThreadContextBaseE[_ZTIN11__sanitizer17ThreadContextBaseE]+0x0):
undefined reference to `vtable for __cxxabiv1::__class_type_info'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
configure:5435: $? = 1
configure:5473: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
(...)
I tested clang with dfsan on my machine and it works. I also tested the
above conftest.c for compilation and everything looks fine. (On a side
note, I tested compiling the same projects with clang only + the same
configure scripts and it works.)
Any ideas? Can clang + dfsan be used with autotools configure scripts?
Thanks,
Fred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140522/50cafbe4/attachment.html>
More information about the cfe-dev
mailing list