[PATCH] D85627: [polly][cmake] Don't build LLVMPolly.so without PIC

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 02:01:45 PDT 2020


This revision was automatically updated to reflect the committed changes.
ro marked an inline comment as done.
Closed by commit rG26d659bbe080: [polly][cmake] Don't build LLVMPolly.so without PIC (authored by ro).

Changed prior to commit:
  https://reviews.llvm.org/D85627?vs=286559&id=288234#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85627/new/

https://reviews.llvm.org/D85627

Files:
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/CMakeLists.txt


Index: polly/lib/CMakeLists.txt
===================================================================
--- polly/lib/CMakeLists.txt
+++ polly/lib/CMakeLists.txt
@@ -137,8 +137,9 @@
 
 # Create a loadable module Polly.so that can be loaded using
 # LLVM's/clang's "-load" option.
-if (MSVC)
-  # Add dummy target, because loadable modules are not supported on Windows
+if (MSVC OR NOT LLVM_ENABLE_PIC)
+  # Add dummy target, either because loadable modules are not supported
+  # as on Windows or because PIC code has been disabled
   add_custom_target(LLVMPolly)
   set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
 else ()
Index: polly/cmake/CMakeLists.txt
===================================================================
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -10,8 +10,8 @@
 endif()
 
 set(POLLY_CONFIG_EXPORTED_TARGETS Polly ${ISL_TARGET})
-if (NOT MSVC)
-  # LLVMPolly is a dummy target on Win
+if (NOT MSVC AND LLVM_ENABLE_PIC)
+  # LLVMPolly is a dummy target on Win or if PIC code is disabled.
   list(APPEND POLLY_CONFIG_EXPORTED_TARGETS LLVMPolly)
 endif()
 if (POLLY_ENABLE_GPGPU_CODEGEN)
Index: polly/CMakeLists.txt
===================================================================
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -39,8 +39,10 @@
     set(POLLY_GTEST_AVAIL 1)
   endif()
 
-  # Make sure the isl c files are built as fPIC
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+  if (LLVM_ENABLE_PIC)
+    # Make sure the isl c files are built as fPIC if possible
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+  endif ()
 
   # Set directory for polly-isl-test.
   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85627.288234.patch
Type: text/x-patch
Size: 1702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/e61dcd33/attachment.bin>


More information about the llvm-commits mailing list