From 43607d0b7e176f0de9d4c9b08b62394fb228ff1c Mon Sep 17 00:00:00 2001 From: lizzie Date: Tue, 15 Sep 2026 06:36:27 +0000 Subject: [PATCH] 2026-09-15 06:36:27 Signed-off-by: lizzie --- CMakeLists.txt | 7 +++++++ src/yuzu/CMakeLists.txt | 3 +++ src/yuzu_cmd/CMakeLists.txt | 3 +++ 3 files changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f647204a4b..93185eed4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,13 @@ if (MSVC AND ARCHITECTURE_x86) instead, run vcvars64.bat directly, located at C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat") endif() +# Required for ICF builds +if (NOT MSVC) + add_compile_options( + $<$:-ffunction-sections> + $<$:-fdata-sections>) +endif() + if (CXX_CLANG_CL) # clang-cl prints literally 10000+ warnings without this add_compile_options( diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index b93080f2a1..7bc4c1a098 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -444,6 +444,9 @@ if (YUZU_ROOM) target_link_libraries(yuzu PRIVATE yuzu-room) endif() +if (NOT MSVC) + target_link_options(yuzu PRIVATE "LINKER:--icf=all,--gc-sections") +endif() if (NOT MSVC AND (APPLE OR NOT YUZU_STATIC_BUILD)) # needed for vma target_compile_options(yuzu PRIVATE diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt index 09a9bd6da1..5be5dea622 100644 --- a/src/yuzu_cmd/CMakeLists.txt +++ b/src/yuzu_cmd/CMakeLists.txt @@ -67,6 +67,9 @@ endif() create_target_directory_groups(yuzu-cmd) +if (NOT MSVC) + target_link_options(yuzu PRIVATE "LINKER:--icf=all,--gc-sections") +endif() # needed for vma if (NOT MSVC) target_compile_options(yuzu-cmd PRIVATE