A build on sparcv9-sun-solaris2.11 with -DLLVM_ENABLE_PIC=Off failed linking LLVMPolly.so:
[2277/2297] Linking CXX shared module lib/LLVMPolly.so FAILED: lib/LLVMPolly.so [...] ld: fatal: relocation error: R_SPARC_H44: file tools/polly/lib/CMakeFiles/obj.Polly.dir/Analysis/DependenceInfo.cpp.o: symbol .data._ZL16__gthread_active (section): invalid shared object relocation type: ABS44 code model unsupported [...]
As on many other targets, one cannot link non-PIC objects into a shared object on Solaris/sparcv9.
The following patch avoids this by not building the library without PIC. It allowed the build to finish.
Testing showed one regression however:
FAIL: Polly :: Isl/isl-args.ll (66183 of 67884) [...] Command Output (stderr): -- PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: opt -polly-process-unprofitable -polly-remarks-minimal -polly-use-llvm-names -polly-import-jscop-dir=/vol/llvm/src/llvm-project/dist/polly/test/Isl -polly-codegen-verify -polly-scops -disable-output -polly-isl-arg=-h 1. Running pass 'Function Pass Manager' on module '<stdin>'. 2. Running pass 'Region Pass Manager' on function '@foo_1d' 3. Running pass 'Polly - Create polyhedral description of Scops' on basic block '%bb1' 0 opt 0x000000010460fb70 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 20 1 opt 0x000000010460e650 SignalHandler(int) + 420 2 libc.so.1 0xffffffff7eedc800 __sighndlr + 12 3 libc.so.1 0xffffffff7eecf23c call_user_handler + 852 4 libc.so.1 0xffffffff7eecf594 sigacthandler + 84 5 libc.so.1 0xffffffff7edecd50 strlen + 80 6 libc.so.1 0xffffffff7ee4d28c _ndoprnt + 20 7 libc.so.1 0xffffffff7ee4c110 printf + 272 8 opt 0x0000000105208814 print_bool_help + 308 9 opt 0x0000000105209e70 isl_args_parse + 1764 10 opt 0x0000000104f36310 polly::Scop::Scop(llvm::Region&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::DominatorTree&, polly::ScopDetection::DetectionContext&, llvm::OptimizationRemarkEmitter&, int) + 692 11 opt 0x0000000104f69b50 polly::ScopBuilder::buildScop(llvm::Region&, llvm::AssumptionCache&) + 80 12 opt 0x0000000104f6ada0 polly::ScopBuilder::ScopBuilder(llvm::Region*, llvm::AssumptionCache&, llvm::AAResults&, llvm::DataLayout const&, llvm::DominatorTree&, llvm::LoopInfo&, polly::ScopDetection&, llvm::ScalarEvolution&, llvm::OptimizationRemarkEmitter&) + 588 13 opt 0x0000000104f37400 polly::ScopInfoRegionPass::runOnRegion(llvm::Region*, llvm::RGPassManager&) + 744 14 opt 0x00000001036beda8 llvm::RGPassManager::runOnFunction(llvm::Function&) + 3172 15 opt 0x0000000103dd1c18 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1084 16 opt 0x0000000103dd32e0 llvm::FPPassManager::runOnModule(llvm::Module&) + 32 17 opt 0x0000000103dd0ee0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1440 18 opt 0x00000001021070ac main + 9856 19 opt 0x00000001020e6864 _start + 100
gdb shows that strlen incurred a SEGV which is usually a sign of calling it with NULL. Debugging that requires a Debug build which I don't currently have the time and disk space to try.
Please update the comment