aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorOsmium Sorcerer <os@sof.beauty>2026-09-23 16:16:28 +0000
committerOsmium Sorcerer <os@sof.beauty>2026-09-23 16:16:28 +0000
commit1e4319d7b9208d2ccb105c8a3853ecf97f600e4c (patch)
tree2b3201b705d4820ace5e3f06e753909755e28c1e /CMakeLists.txt
parentb21dfd36cdafd76b5538383279d28b003188fa19 (diff)
Adjust release compilation and linking flags
Remove -pipe because this option is dubious and doesn't do anything. Get rid of unwind tables. They instrument call sites (synchronous) and any instruction boundary (asynchronous). In the release build, they only inflate the size of the executable. Synchronous tables are necessary for C++ exceptions, but, thankfully (and I can't praise the developers enough) AO2 Client doesn't use them at all. Add RELRO and NOW to the linker. While I've already removed PLT at code generation phase with -fno-plt, turns out, ld still stupidly performs lazy linking: the symbols are moved to GOT, but not immediately resolved. That was an oversight of mine, so bring back full RELRO. Add packing of relative relocations. These are moved to a separate compact section, where they're encoded more efficiently.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4dba482..b3786d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,8 +140,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
- target_compile_options(Attorney_Online PRIVATE -O3 -pipe -fno-plt -fno-semantic-interposition -fvisibility=hidden -flto -fno-rtti -fno-exceptions -Werror=odr -Werror=strict-aliasing)
- target_link_options(Attorney_Online PRIVATE -Wl,-O2 -Wl,--as-needed -flto -fuse-ld=lld)
+ target_compile_options(Attorney_Online PRIVATE -O3 -fno-plt -fno-semantic-interposition -fvisibility=hidden -flto -fno-rtti -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Werror=odr -Werror=strict-aliasing)
+ target_link_options(Attorney_Online PRIVATE -Wl,-O2 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto -fuse-ld=lld)
endif()
target_compile_definitions(Attorney_Online PRIVATE AO_BUILD_PROFILE="${CMAKE_BUILD_TYPE}")