[polly][cmake] Don't build LLVMPolly.so without PIC
authorRainer Orth <ro@gcc.gnu.org>
Thu, 27 Aug 2020 08:59:51 +0000 (10:59 +0200)
committerRainer Orth <ro@gcc.gnu.org>
Thu, 27 Aug 2020 08:59:51 +0000 (10:59 +0200)
commit26d659bbe08028c0e04ddc3f4c698a995f41a131
tree35e26e3a9139fe0925adcf877925a68e6749d754
parent7f1bb326ee112c5bec897db2be016289f15a7778
[polly][cmake] Don't build LLVMPolly.so without PIC

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.

Differential Revision: https://reviews.llvm.org/D85627
polly/CMakeLists.txt
polly/cmake/CMakeLists.txt
polly/lib/CMakeLists.txt