77 lines
2.8 KiB
Diff
77 lines
2.8 KiB
Diff
From 223f5481951047fa74a74d57819bb082aa462447 Mon Sep 17 00:00:00 2001
|
|
From: q66 <q66@chimera-linux.org>
|
|
Date: Sun, 14 Apr 2024 14:42:37 +0200
|
|
Subject: [PATCH 10/29] compiler-rt,libcxx(abi),libunwind: HACK: force -fno-lto
|
|
|
|
Also do -ftrivial-auto-var-init=unitialized for libunwind, as it appears
|
|
to break unwinding in strange ways with C++ on ppc64le, particularly with
|
|
LTO; this needs to be investigated properly though.
|
|
|
|
https://github.com/llvm/llvm-project/issues/76771
|
|
---
|
|
compiler-rt/lib/builtins/CMakeLists.txt | 2 +-
|
|
libcxx/CMakeLists.txt | 4 ++++
|
|
libcxxabi/CMakeLists.txt | 4 ++++
|
|
libunwind/src/CMakeLists.txt | 3 +++
|
|
4 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
|
|
index f89cf87c7..51f59457a 100644
|
|
--- a/compiler-rt/lib/builtins/CMakeLists.txt
|
|
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
|
|
@@ -756,7 +756,7 @@ if (APPLE)
|
|
add_subdirectory(macho_embedded)
|
|
darwin_add_builtin_libraries(${BUILTIN_SUPPORTED_OS})
|
|
else ()
|
|
- set(BUILTIN_CFLAGS "")
|
|
+ set(BUILTIN_CFLAGS "-fno-lto")
|
|
add_security_warnings(BUILTIN_CFLAGS 0)
|
|
|
|
if (COMPILER_RT_HAS_FCF_PROTECTION_FLAG)
|
|
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
|
|
index abe12c280..17cf7c7ed 100644
|
|
--- a/libcxx/CMakeLists.txt
|
|
+++ b/libcxx/CMakeLists.txt
|
|
@@ -575,6 +575,10 @@ function(cxx_add_rtti_flags target)
|
|
target_add_compile_flags_if_supported(${target} PUBLIC -fno-rtti)
|
|
endif()
|
|
endif()
|
|
+
|
|
+ target_add_compile_flags_if_supported(${target} PRIVATE "-fno-lto")
|
|
+ target_add_link_flags_if_supported(${target} PRIVATE "-fno-lto")
|
|
+ target_add_link_flags_if_supported(${target} PRIVATE "-rtlib=compiler-rt")
|
|
endfunction()
|
|
|
|
# Modules flags ===============================================================
|
|
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
|
|
index 6dcfc51e5..1d03714f5 100644
|
|
--- a/libcxxabi/CMakeLists.txt
|
|
+++ b/libcxxabi/CMakeLists.txt
|
|
@@ -331,6 +331,10 @@ else()
|
|
add_compile_flags_if_supported(-EHa-)
|
|
endif()
|
|
|
|
+add_compile_flags("-fno-lto")
|
|
+add_link_flags("-fno-lto")
|
|
+add_link_flags("-rtlib=compiler-rt")
|
|
+
|
|
# Assert
|
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
|
if (LIBCXXABI_ENABLE_ASSERTIONS)
|
|
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
|
|
index ecbd019bb..ec4108bd9 100644
|
|
--- a/libunwind/src/CMakeLists.txt
|
|
+++ b/libunwind/src/CMakeLists.txt
|
|
@@ -136,6 +136,9 @@ if (HAIKU)
|
|
endif()
|
|
endif ()
|
|
|
|
+add_compile_flags("-fno-lto -ftrivial-auto-var-init=uninitialized")
|
|
+add_link_flags("-fno-lto -ftrivial-auto-var-init=uninitialized")
|
|
+
|
|
string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
|
|
string(REPLACE ";" " " LIBUNWIND_CXX_FLAGS "${LIBUNWIND_CXX_FLAGS}")
|
|
string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
|
|
--
|
|
2.49.0
|
|
|