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

Igor Sugak via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 10:28:49 PST 2016


Hans: this diff has been accepted, please commit this for me. Also may you cherry-pick it to release_38 branch? 

Thanks,
Igor
_______________________________________
From: cfe-commits [cfe-commits-bounces at lists.llvm.org] on behalf of Igor Sugak via cfe-commits [cfe-commits at lists.llvm.org]
Sent: Tuesday, February 09, 2016 3:30 PM
To: sugak.igor at gmail.com; beanz at apple.com
Cc: cfe-commits at lists.llvm.org
Subject: [PATCH] D17049: [CMake] don't build libLTO when LLVM_ENABLE_PIC is OFF

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://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D26484&d=CwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=LlbfLxvkyuVVPfVvG7EAbQ&m=QXrW3PDkneI81zGZn-LEptk5m7GpOswFm7IpJAn5JFE&s=RKQOsW0jTtIyY8BaKKVoXwQaZt7mZev774CSvB5tqyQ&e= .
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.

https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D17049&d=CwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=LlbfLxvkyuVVPfVvG7EAbQ&m=QXrW3PDkneI81zGZn-LEptk5m7GpOswFm7IpJAn5JFE&s=rlz6GoNQMQ9BEk8XgUcqyzzcfM8NU9xAnRFMeSyez9A&e=

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()




More information about the llvm-commits mailing list