This is a preparation patch to allow the runtime code to include common definitions including per function header, raw header struct, raw version, raw magic and section names.
Details
Diff Detail
Event Timeline
This code breaks builds with LLVM_EXTERNAL_COMPILER_RT=On or any out-of-tree compiler-rt build.
LLVM_MAIN_INCLUDE_DIR is not always set, and you can't expect it to be set.
David, it doesn't look like there's a way to directly include files from llvm.
I think we should split out what's needed into an *.inc file and duplicate it between llvm and compiler-rt. This is probably worth a discussion on the list.
I rolled back the change for now.
Chris, what is the use case of out of tree compile-rt build? In
compile-rt.llvm.org, it says "Generally, you need to build LLVM/Clang in
order to build compiler-rt". It seems pointless building it separately.
thanks,
David
There are a lot of uses of out-of-tree compiler-rt builds.
(1) gcc uses the sanitizers
(2) LLVM_BUILD_EXTERNAL_COMPILER_RT is a CMake option that does an out-of-tree build in-tree. Basically CMake magic to use the just-built clang
(3) we support building Clang out-of-tree against installed LLVM binaries, and those people need to build compiler-rt too.
I'm sure there are more reasons people do this.
We explicitly don't have dependencies between compiler-rt and other LLVM projects because there are people who use compiler-rt with other compilers, and there is no hard technical tie between compiler-rt and clang or LLVM.
-Chris
Longer term we probably need to exclude profile runtime when compiler-rt is build standalone -- however this will have implications and require more discussions in llvm-dev.
The profile runtime refactoring can still be done by extracting ABI related defs into one common file which will be duplicated between profile runtime and LLVM. This won't reduce the profile runtime maintenance overhead to zero, but should be close enough.