[PATCH] D140880: Disable PIE
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 3 04:11:14 PST 2023
foad created this revision.
Herald added a project: All.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This speeds up lit testing on systems where the host toolchain enables
PIE by default. For example on my Ubuntu 22.04 system, using the host's
default clang and lld, this speeds up check-llvm by around 1.75x.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140880
Files:
llvm/cmake/config-ix.cmake
Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -408,12 +408,19 @@
set(ENABLE_PIC 1)
else()
set(ENABLE_PIC 0)
- check_cxx_compiler_flag("-fno-pie" SUPPORTS_NO_PIE_FLAG)
- if(SUPPORTS_NO_PIE_FLAG)
+ check_cxx_compiler_flag("-fno-pie" SUPPORTS_FNO_PIE_FLAG)
+ if(SUPPORTS_FNO_PIE_FLAG)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie")
endif()
endif()
+# In case the linker enables PIE by default, disable it for much faster lit
+# testing.
+check_cxx_compiler_flag("-no-pie" SUPPORTS_NO_PIE_FLAG)
+if(SUPPORTS_NO_PIE_FLAG)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
+endif()
+
check_cxx_compiler_flag("-Wvariadic-macros" SUPPORTS_VARIADIC_MACROS_FLAG)
check_cxx_compiler_flag("-Wgnu-zero-variadic-macro-arguments"
SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140880.485955.patch
Type: text/x-patch
Size: 969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230103/33ca2d16/attachment.bin>
More information about the llvm-commits
mailing list