From 510638eaa788a8ca67902c2d1ee0f9cb5a9fcd44 Mon Sep 17 00:00:00 2001 From: mmel Date: Tue, 9 May 2017 12:14:00 +0000 Subject: [PATCH] Fix _Unwind_Backtrace symbol version for ARM. In real GNU libgcc, _Unwind_Backtrace is published with GCC_3.3 version for all architectures but ARM. For ARM it's publishes with GCC_4.3.0 version. This exception is not implement in your version of libggc, thus we export _Unwind_Backtrace with bad version. To maintain backward compatibility, publish _Unwind_Backtrace twice, once as compatible symbol with GCC_3.3 version, and once as default symbol with GCC_4.3.0 version. While I'm in, fix typo in GCC_4.2.0 to GCC_4.3.0 inheritance declaration. MFC after: 2 weeks --- contrib/gcc/config/arm/libgcc-bpabi.ver | 8 ++++++++ contrib/gcc/config/arm/libunwind-arm.S | 18 ++++++++++++++++++ contrib/gcc/libgcc-std.ver | 2 +- sys/arm/conf/std.armv6 | 8 ++++---- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/contrib/gcc/config/arm/libgcc-bpabi.ver b/contrib/gcc/config/arm/libgcc-bpabi.ver index 2f259eb646e0..26d3c49608cb 100644 --- a/contrib/gcc/config/arm/libgcc-bpabi.ver +++ b/contrib/gcc/config/arm/libgcc-bpabi.ver @@ -81,3 +81,11 @@ GCC_3.5 { # GNU-specific entry point. __gnu_unwind_frame } + +%exclude { + _Unwind_Backtrace +} + +GCC_4.3.0 { + _Unwind_Backtrace +} diff --git a/contrib/gcc/config/arm/libunwind-arm.S b/contrib/gcc/config/arm/libunwind-arm.S index 8b1e2f3722e4..da553a4bfe78 100644 --- a/contrib/gcc/config/arm/libunwind-arm.S +++ b/contrib/gcc/config/arm/libunwind-arm.S @@ -133,4 +133,22 @@ UNWIND_WRAPPER _Unwind_Resume_or_Rethrow 1 UNWIND_WRAPPER _Unwind_ForcedUnwind 3 UNWIND_WRAPPER _Unwind_Backtrace 2 +/* + * Originally, we incorrectly export _Unwind_Backtrace symbol + * with GCC_3.3 version, but real GCC libgcc export it as GCC_4.3.0. + * To maintain backward compatibility, export it with both versions where + * GCC_4.3.0 is default one. + * + * The workaround is complicated by next two issues: + * - old GNU ld cannot handle two (or more) symbol versions + * targeting same function. + * - the .weakref crashes clang 4.0 + */ + .globl SYM(_Unwind_Backtrace33) + TYPE(_Unwind_Backtrace33) +SYM(_Unwind_Backtrace33): + b _Unwind_Backtrace + + .symver SYM(_Unwind_Backtrace33),_Unwind_Backtrace@GCC_3.3 + #endif /* ndef __symbian__ */ diff --git a/contrib/gcc/libgcc-std.ver b/contrib/gcc/libgcc-std.ver index 2d0a43df01d3..6e747ed7bc1b 100644 --- a/contrib/gcc/libgcc-std.ver +++ b/contrib/gcc/libgcc-std.ver @@ -275,7 +275,7 @@ GCC_4.2.0 { _Unwind_GetIPInfo } -%inherit GCC_4.3 GCC_4.2.0 +%inherit GCC_4.3.0 GCC_4.2.0 GCC_4.3.0 { # byte swapping routines __bswapsi2 diff --git a/sys/arm/conf/std.armv6 b/sys/arm/conf/std.armv6 index 4ee9caff32e7..2bf63c8b2793 100644 --- a/sys/arm/conf/std.armv6 +++ b/sys/arm/conf/std.armv6 @@ -68,10 +68,10 @@ options USB_DEBUG # Enable usb debug support code # Optional extras, never enabled by default: #options BOOTVERBOSE #options DEBUG # May result in extreme spewage -#options KTR -#options KTR_COMPILE=KTR_ALL -#options KTR_ENTRIES=16384 -#options KTR_MASK=(KTR_SPARE2) +options KTR +options KTR_COMPILE=KTR_ALL +options KTR_ENTRIES=163840 +options KTR_MASK=(KTR_SPARE3) #options KTR_VERBOSE=0 #options USB_REQ_DEBUG #options USB_VERBOSE