Hi,<div><br></div><div>tl;dr How can I include LLVM headers and use code from libLLVM*.a files when building compiler-rt libraries?</div><div><br></div><div>I'd like to create a symbolizer that would be used in AddressSanitizer (ASan) and ThreadSanitizer (TSan) tools which are now part of</div>
<div>projects/compiler-rt (as a first step, symbolizer should be able to return file/line info for a given address).</div><div>I'd like to use and gradually extend the interface in "llvm/DebugInfo/DIContext.h"</div>
<div>I see two obstacles:</div><div><br></div><div>1) How can I include LLVM headers in source files inside projects/compiler-rt?</div><div>As a local workaround, I modify configuration for ASan/TSan runtimes as follows:</div>
<div>CFLAGS.asan-x86_64 := $(CFLAGS) -I$(PathToLLVMInclude) -I$(PathToLLVMBuildInclude)</div><div>Note that I need both "/path/to/llvm_checkout/include" and "/path/to/llvm_build/include", because some LLVM headers are generated when</div>
<div>LLVM is built (e.g. "llvm/Support/DataTypes.h"). This looks very broken, as paths are hardcoded, and LLVM headers are</div><div>not included in dependencies for ASan/TSan runtime.</div><div><div><br></div><div>
2) How can I use LLVM libraries when building compiler-rt?</div><div>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".</div><div>
Can I somehow make this runtime contain compiled LLVM libraries as well?</div><div>Currently I need libLLVMDebugInfo.a and libLLVMSupport.a.</div><div><br></div><div>For now, I patch Clang driver, so that it would pass all the necessary LLVM libraries to linker whenever</div>
<div>it sees -faddress-sanitizer or -fthread-sanitizer flags, but this also looks hacky.</div><div><br></div><div>TIA</div><div><br></div><div>-- </div><div>Alexey Samsonov, MSK</div><br>
</div>