[llvm] r253959 - [CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 00:04:59 PST 2015


Author: cbieneman
Date: Tue Nov 24 02:04:59 2015
New Revision: 253959

URL: http://llvm.org/viewvc/llvm-project?rev=253959&view=rev
Log:
[CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.

Building clang with -fno-pie generates slightly faster code. In my not-very-rigorous testing I saw about a 4% speed up using the clang test-suite sources.

Modified:
    llvm/trunk/cmake/config-ix.cmake

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=253959&r1=253958&r2=253959&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Tue Nov 24 02:04:59 2015
@@ -299,6 +299,10 @@ if( LLVM_ENABLE_PIC )
   set(ENABLE_PIC 1)
 else()
   set(ENABLE_PIC 0)
+  check_cxx_compiler_flag("-fno-pie" SUPPORTS_NO_PIE_FLAG)
+  if(SUPPORTS_NO_PIE_FLAG)
+    list(APPEND CMAKE_EXE_LINKER_FLAGS "-fno-pie")
+  endif()
 endif()
 
 check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)




More information about the llvm-commits mailing list