git: 26055f17590e - stable/12 - Reapply r354347 (by cem):
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Dec 2021 10:05:42 UTC
The branch stable/12 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=26055f17590e78db47d51bab9798cd7bdeba3b3b
commit 26055f17590e78db47d51bab9798cd7bdeba3b3b
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2020-08-06 19:05:59 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-22 09:58:20 +0000
Reapply r354347 (by cem):
Fix llvm-libunwind userspace build on ARM
GCC's libgcc exports a few ARM-specific symbols for ARM EABI, AEABI, or
EHABI or whatever it's called. Export the same ones from LLVM-libunwind's
libgcc_s, on ARM. As part of this, convert libgcc_s from a direct
Version.map to one constructed from component Symbol.map files. This allows
the ARM-specific Symbol.map to be included only on ARM.
Fix ARM-only oddities in struct name/aliases in LLVM-libunwind to match
non-ARM definitions and ARM-specific expectations in libcxxrt /
libcompiler_rt.
No functional change intended for non-ARM architectures.
This commit does not actually flip the switch for ARM defaults from libgcc
to llvm-libunwind, but makes it possible (to compile, anyway).
(cherry picked from commit 998a72c55d958bcc1869628318477532dc6e1ffa)
---
.../compiler-rt/lib/builtins/gcc_personality_v0.c | 17 ++++++++++++++++-
contrib/llvm-project/libunwind/include/unwind.h | 14 +++++++++-----
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/gcc_personality_v0.c b/contrib/llvm-project/compiler-rt/lib/builtins/gcc_personality_v0.c
index d12ee03c49fe..b986bd56943e 100644
--- a/contrib/llvm-project/compiler-rt/lib/builtins/gcc_personality_v0.c
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/gcc_personality_v0.c
@@ -9,8 +9,23 @@
#include "int_lib.h"
#include <unwind.h>
+/*
+ * XXX On FreeBSD, this file is compiled into three libraries:
+ * - libcompiler_rt
+ * - libgcc_eh
+ * - libgcc_s
+ *
+ * In the former, the include path points to the contrib/libcxxrt/unwind-arm.h
+ * copy of unwind.h. In the latter, the include path points to the
+ * contrib/libunwind/include/unwind.h header (LLVM libunwind).
+ *
+ * Neither (seemingly redundant) variant of unwind.h needs the redefinitions
+ * provided in the "helpful" header below, and libcxxrt's unwind-arm.h provides
+ * *no* useful distinguishing macros, so just forcibly disable the helper
+ * header on FreeBSD.
+ */
#if defined(__arm__) && !defined(__ARM_DWARF_EH__) && \
- !defined(__USING_SJLJ_EXCEPTIONS__)
+ !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__FreeBSD__)
// When building with older compilers (e.g. clang <3.9), it is possible that we
// have a version of unwind.h which does not provide the EHABI declarations
// which are quired for the C personality to conform to the specification. In
diff --git a/contrib/llvm-project/libunwind/include/unwind.h b/contrib/llvm-project/libunwind/include/unwind.h
index 1d3444cd83b4..3a6cd116d33c 100644
--- a/contrib/llvm-project/libunwind/include/unwind.h
+++ b/contrib/llvm-project/libunwind/include/unwind.h
@@ -66,12 +66,16 @@ static const _Unwind_State _US_ACTION_MASK = 3;
static const _Unwind_State _US_FORCE_UNWIND = 8;
typedef uint32_t _Unwind_EHT_Header;
+/*
+ * gcc_personality_v0 references 'struct _Unwind_Exception' all over the place.
+ * Nothing in libunwind cares about 'struct _Unwind_Control_Block,' so make it
+ * the alias of struct _Unwind_Exception, instead of the other way around.
+ */
+struct _Unwind_Exception;
+typedef struct _Unwind_Exception _Unwind_Exception;
+typedef struct _Unwind_Exception _Unwind_Control_Block; /* Alias */
-struct _Unwind_Control_Block;
-typedef struct _Unwind_Control_Block _Unwind_Control_Block;
-typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */
-
-struct _Unwind_Control_Block {
+struct _Unwind_Exception {
uint64_t exception_class;
void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block*);