[LLVMdev] Using LLVM code in projects/compiler-rt
Alexey Samsonov
samsonov at google.com
Thu May 31 02:02:36 PDT 2012
Hi,
tl;dr How can I include LLVM headers and use code from libLLVM*.a files
when building compiler-rt libraries?
I'd like to create a symbolizer that would be used in AddressSanitizer
(ASan) and ThreadSanitizer (TSan) tools which are now part of
projects/compiler-rt (as a first step, symbolizer should be able to return
file/line info for a given address).
I'd like to use and gradually extend the interface in
"llvm/DebugInfo/DIContext.h"
I see two obstacles:
1) How can I include LLVM headers in source files inside
projects/compiler-rt?
As a local workaround, I modify configuration for ASan/TSan runtimes as
follows:
CFLAGS.asan-x86_64 := $(CFLAGS) -I$(PathToLLVMInclude)
-I$(PathToLLVMBuildInclude)
Note that I need both "/path/to/llvm_checkout/include" and
"/path/to/llvm_build/include", because some LLVM headers are generated when
LLVM is built (e.g. "llvm/Support/DataTypes.h"). This looks very broken, as
paths are hardcoded, and LLVM headers are
not included in dependencies for ASan/TSan runtime.
2) How can I use LLVM libraries when building compiler-rt?
Currently, compiler-rt builds (linux) runtime and stores it as an .a file
in "/path/to/llvm_build/Release+Asserts/lib/clang/3.2/linux".
Can I somehow make this runtime contain compiled LLVM libraries as well?
Currently I need libLLVMDebugInfo.a and libLLVMSupport.a.
For now, I patch Clang driver, so that it would pass all the necessary LLVM
libraries to linker whenever
it sees -faddress-sanitizer or -fthread-sanitizer flags, but this also
looks hacky.
TIA
--
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120531/fcd61dab/attachment.html>
More information about the llvm-dev
mailing list