CMake: moves no-pie config to CI configs

This commit is contained in:
Carter Li
2026-10-03 08:32:49 +08:00
parent 5f65515c3c
commit 7f458b03e8
14 changed files with 13 additions and 25 deletions
-12
View File
@@ -292,18 +292,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel"
# backtrace() / gdb / perf / crash-dump stack walking in a release binary.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-asynchronous-unwind-tables")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-asynchronous-unwind-tables")
if(NOT WIN32 AND NOT APPLE AND NOT ANDROID)
# Drops .rela.dyn (250 KB) and .data.rel.ro (169 KB) on ELF and removes every load-time
# relocation, so startup gets faster too. The cost is ASLR, and a distro that builds with
# hardening=+all / %_hardened_build passes -fPIE -pie and overrides this anyway.
# Skipped on Windows (PE has no PIE, clang warns "-no-pie unused"), on macOS (Mach-O has no
# .rela.dyn, and turning PIE off fights the code-signing defaults) and on Android, which
# rejects non-PIE executables outright.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-pie")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-pie")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()
endif()
#######################