svn commit: r354347 - in head: contrib/compiler-rt/lib/builtins contrib/libunwind/include lib/libcompiler_rt lib/libgcc_s lib/libgcc_s/arm
Conrad Meyer
cem at FreeBSD.org
Tue Nov 5 03:20:42 UTC 2019
Author: cem
Date: Tue Nov 5 03:20:40 2019
New Revision: 354347
URL: https://svnweb.freebsd.org/changeset/base/354347
Log:
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).
Added:
head/lib/libgcc_s/Symbol.map
- copied, changed from r354346, head/lib/libgcc_s/Version.map
head/lib/libgcc_s/Versions.def (contents, props changed)
head/lib/libgcc_s/arm/
head/lib/libgcc_s/arm/Symbol.map (contents, props changed)
Deleted:
head/lib/libgcc_s/Version.map
Modified:
head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c
head/contrib/libunwind/include/unwind.h
head/lib/libcompiler_rt/Makefile
head/lib/libgcc_s/Makefile
Modified: head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c
==============================================================================
--- head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c Tue Nov 5 02:30:41 2019 (r354346)
+++ head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c Tue Nov 5 03:20:40 2019 (r354347)
@@ -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
Modified: head/contrib/libunwind/include/unwind.h
==============================================================================
--- head/contrib/libunwind/include/unwind.h Tue Nov 5 02:30:41 2019 (r354346)
+++ head/contrib/libunwind/include/unwind.h Tue Nov 5 03:20:40 2019 (r354347)
@@ -66,12 +66,16 @@ static const _Unwind_State _US_ACTION_MASK
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*);
Modified: head/lib/libcompiler_rt/Makefile
==============================================================================
--- head/lib/libcompiler_rt/Makefile Tue Nov 5 02:30:41 2019 (r354346)
+++ head/lib/libcompiler_rt/Makefile Tue Nov 5 03:20:40 2019 (r354347)
@@ -12,10 +12,6 @@ CFLAGS+= -fvisibility=hidden
CFLAGS+= -DVISIBILITY_HIDDEN
CFLAGS+= -I${SRCTOP}/contrib/libcxxrt
-.if ${COMPILER_TYPE} == "clang"
-CWARNFLAGS.gcc_personality_v0.c+= -Wno-typedef-redefinition
-.endif
-
# gcc has incompatible internal declarations for __divtc3 and __multc3, but has
# no option to silence its warning, so make warnings non-fatal.
NO_WERROR.gcc=
Modified: head/lib/libgcc_s/Makefile
==============================================================================
--- head/lib/libgcc_s/Makefile Tue Nov 5 02:30:41 2019 (r354346)
+++ head/lib/libgcc_s/Makefile Tue Nov 5 03:20:40 2019 (r354347)
@@ -4,12 +4,22 @@ PACKAGE= clibs
SHLIB_NAME= libgcc_s.so.1
SHLIBDIR?= /lib
+.include <bsd.opts.mk>
+
MK_SSP= no
WARNS?= 2
LDFLAGS+= -nodefaultlibs
LIBADD+= c
-VERSION_MAP= ${.CURDIR}/Version.map
+
+.if ${MK_SYMVER} == "yes"
+VERSION_DEF= ${.CURDIR}/Versions.def
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+# Export ARM AEABI unwind routines needed by libc and libthr.
+.if exists(${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map)
+SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map
+.endif
+.endif
.include "../libcompiler_rt/Makefile.inc"
.include "../libgcc_eh/Makefile.inc"
Copied and modified: head/lib/libgcc_s/Symbol.map (from r354346, head/lib/libgcc_s/Version.map)
==============================================================================
--- head/lib/libgcc_s/Version.map Tue Nov 5 02:30:41 2019 (r354346, copy source)
+++ head/lib/libgcc_s/Symbol.map Tue Nov 5 03:20:40 2019 (r354347)
@@ -3,7 +3,6 @@
*/
GCC_3.0 {
-global:
__absvdi2;
__absvsi2;
__addvdi3;
@@ -84,8 +83,6 @@ global:
_Unwind_Resume;
_Unwind_SetGR;
_Unwind_SetIP;
-local:
- *;
};
GCC_3.3 {
@@ -93,11 +90,11 @@ GCC_3.3 {
_Unwind_FindEnclosingFunction;
_Unwind_GetCFA;
_Unwind_Resume_or_Rethrow;
-} GCC_3.0;
+};
GCC_3.3.1 {
__gcc_personality_v0;
-} GCC_3.3;
+};
GCC_3.4 {
__clzdi2;
@@ -112,11 +109,11 @@ GCC_3.4 {
__popcountdi2;
__popcountsi2;
__popcountti2;
-} GCC_3.3.1;
+};
GCC_3.4.2 {
__enable_execute_stack;
-} GCC_3.4;
+};
GCC_3.4.4 {
__absvti2;
@@ -124,7 +121,7 @@ GCC_3.4.4 {
__mulvti3;
__negvti2;
__subvti3;
-} GCC_3.4.2;
+};
GCC_4.0.0 {
__divdc3;
@@ -136,7 +133,7 @@ GCC_4.0.0 {
__powidf2;
__powisf2;
__powixf2;
-} GCC_3.4.4;
+};
GCC_4.2.0 {
__floatundidf;
@@ -146,9 +143,9 @@ GCC_4.2.0 {
__floatuntisf;
__floatuntixf;
_Unwind_GetIPInfo;
-} GCC_4.0.0;
+};
GCC_4.3.0 {
__bswapdi2;
__bswapsi2;
-} GCC_4.2.0;
+};
Added: head/lib/libgcc_s/Versions.def
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/lib/libgcc_s/Versions.def Tue Nov 5 03:20:40 2019 (r354347)
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+GCC_3.0 {
+};
+
+GCC_3.3 {
+} GCC_3.0;
+
+GCC_3.3.1 {
+} GCC_3.3;
+
+GCC_3.4 {
+} GCC_3.3.1;
+
+GCC_3.4.2 {
+} GCC_3.4;
+
+GCC_3.4.4 {
+} GCC_3.4.2;
+
+GCC_3.5 {
+} GCC_3.4.4;
+
+GCC_4.0.0 {
+} GCC_3.5;
+
+GCC_4.2.0 {
+} GCC_4.0.0;
+
+GCC_4.3.0 {
+} GCC_4.2.0;
Added: head/lib/libgcc_s/arm/Symbol.map
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/lib/libgcc_s/arm/Symbol.map Tue Nov 5 03:20:40 2019 (r354347)
@@ -0,0 +1,12 @@
+/*
+ * $FreeBSD$
+ */
+
+GCC_3.5 {
+ _Unwind_VRS_Get;
+ _Unwind_VRS_Set;
+ __aeabi_unwind_cpp_pr0;
+ __aeabi_unwind_cpp_pr1;
+ __aeabi_unwind_cpp_pr2;
+ __gnu_unwind_frame;
+};
More information about the svn-src-head
mailing list