[libunwind] [libunwind][cmake] Compile _Unwind* routines with -fexceptions (PR #121819)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 6 11:15:48 PST 2025
https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/121819
When building libunwind with LTO, we found that routines, like
_Unwind_RaiseException were marked `nounwind`. This causes problems when
libunwind is then used with exception throwing code, since many of the
routines are marked `nounwind`. This causes miscompiles, and the
incorrect generation of unwind tables (see #120657).
In #56825, it was pointed out that these C routines should be compiled
with `-fexceptions`, to prevent this from happening. Since we only add
the `-fexceptions` flag to C sources, there shouldn't be any conflict
with any C++ sources or interactions with libcxx/libcxxabi.
Fixes #56825 #120657
>From 9f952de3cb3e973f17121c057089a28bf4c6e5e0 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 6 Jan 2025 11:15:35 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6-beta.1
---
libunwind/src/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index e7ea57734cca97..72dd3f5bca9960 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -20,7 +20,7 @@ set(LIBUNWIND_C_SOURCES
)
set_source_files_properties(${LIBUNWIND_C_SOURCES}
PROPERTIES
- COMPILE_FLAGS "-std=c99")
+ COMPILE_FLAGS "-std=c99 -fexceptions")
set(LIBUNWIND_ASM_SOURCES
UnwindRegistersRestore.S
More information about the cfe-commits
mailing list