[mlir] Avoid building some shared libraries when PIC is off
When `LLVM_ENABLE_PIC = OFF`, shared libraries cannot be built against code that's compiled without -fPIC. Example error message: `` ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC >>> defined in lib/libLLVMSupport.a(StringMap.cpp.o) >>> referenced by StringMap.cpp >>> StringMap.cpp.o:(llvm::StringMapImpl::StringMapImpl(unsigned >>> int, unsigned int)) in archive lib/libLLVMSupport.a `` Similar to [how libclang handles this](https://github.com/llvm/llvm-project/blob/main/clang/tools/clang-shlib/CMakeLists.txt#L2-L4), skip building these shared libraries when `LLVM_ENABLE_PIC = OFF`. Differential Revision: https://reviews.llvm.org/D142941
Loading
Please sign in to comment