fix: CachyOS LTO Compilation

Fix LTO linking issues on CachyOS with GCC 15.x

- Add LTO support to all core library targets (input_common, frontend_common,
  network, shader_recompiler, web_service) that were missing LTO configuration
- Create citron_configure_lto() helper function for consistent LTO handling
- Implement CachyOS-specific detection via /etc/os-release and kernel version
- Apply conservative LTO flags (-flto=auto -ffat-lto-objects) only for
  CachyOS + GCC 15+ to resolve linking errors with newer toolchains
- Other distributions continue using aggressive LTO settings for maximum performance
- Disable LTO on executable targets to prevent main function optimization issues

This resolves "undefined symbol" errors when building with -DCITRON_ENABLE_LTO=ON
on CachyOS while maintaining optimal LTO performance on other distributions.

Fixes linking errors including:
- Core::Frontend::EmuWindow symbols
- Core::System methods
- Settings::values
- Common logging functions

Tested on CachyOS with GCC 15.1.1 + LLD 20.1.8

Signed-off-by: Boss.sfc <boss.sfc@citron-emu.org>
This commit is contained in:
Boss.sfc
2025-07-22 21:37:37 +07:00
parent d0ae8f1582
commit fc480dcb69
11 changed files with 49 additions and 6 deletions

View File

@@ -266,3 +266,5 @@ create_target_directory_groups(shader_recompiler)
if (CITRON_USE_PRECOMPILED_HEADERS)
target_precompile_headers(shader_recompiler PRIVATE precompiled_headers.h)
endif()
citron_configure_lto(shader_recompiler)