[PATCH] D17049: [CMake] don't build libLTO when LLVM_ENABLE_PIC is OFF

Igor Sugak via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 15:30:23 PST 2016


sugak created this revision.
sugak added a reviewer: beanz.
sugak added subscribers: hans, cfe-commits.
Herald added a subscriber: joker.eph.

When cmake is run with `-DLLVM_ENABLE_PIC=OFF`, build fails while
linking shared library libLTO.so, because its dependencies are built
with -fno-PIC. More details here: https://llvm.org/bugs/show_bug.cgi?id=26484.
This diff reverts r252652 (git 9fd4377ddb83aee3c049dc8757e7771edbb8ee71),
which removed check `NOT LLVM_ENABLE_PIC` before enabling build for libLTO.so.

I've verified that when cmake is run with `-DLLVM_ENABLE_PIC=ON`, libLTO.so is
still generated, as well as when this option is not specified and the default
value (ON) is used. Tested both on master and release_38.

http://reviews.llvm.org/D17049

Files:
  tools/CMakeLists.txt

Index: tools/CMakeLists.txt
===================================================================
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -25,7 +25,7 @@
   set(LLVM_TOOL_LLVM_JITLISTENER_BUILD Off)
 endif()
 
-if(CYGWIN)
+if(CYGWIN OR NOT LLVM_ENABLE_PIC)
   set(LLVM_TOOL_LTO_BUILD Off)
   set(LLVM_TOOL_LLVM_LTO_BUILD Off)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17049.47383.patch
Type: text/x-patch
Size: 345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160209/ace46d37/attachment.bin>


More information about the cfe-commits mailing list