app-emulation/wine-vanilla: fix clang + USE=-llvm-libunwind build

_Unwind_Find_FDE doesn't exist in libunwind but does in gcc's rtlib,
clang instead expects it from llvm-libunwind which leads to undefined
references even with USE=-unwind.

Messy but add extra guards around it.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2022-09-13 00:17:36 -04:00
parent 7b8507314b
commit 2bb5c034ea
5 changed files with 43 additions and 12 deletions
@@ -1,9 +0,0 @@
Note the dodgy _CONFIG_H_ check can be removed when >=llvm-libunwind-15
(which adds _VERSION) is well established: https://reviews.llvm.org/D121015
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -1359,3 +1359,3 @@
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__)
rc = unw_getcontext( &unw_context );
@@ -0,0 +1,40 @@
Fix build with llvm-libunwind, and also fix for non-llvm libunwind
when using clang+bfd given clang doesn't have _Unwind_Find_FDE in
its rtlib and expects it from llvm-libunwind.
The _CONFIG_H_ check is for <llvm-libunwind-15 (adds _VERSION).
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -635,7 +635,9 @@
unsigned int cie_offset;
};
+#if defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__) || !defined(__clang__)
extern const struct dwarf_fde *_Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
+#endif
static unsigned char dwarf_get_u1( const unsigned char **p )
{
@@ -1357,7 +1359,7 @@
unw_proc_info_t info;
int rc;
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__)
rc = unw_getcontext( &unw_context );
if (rc == UNW_ESUCCESS)
rc = unw_init_local( &cursor, &unw_context );
@@ -1480,11 +1482,13 @@
NTSTATUS CDECL unwind_builtin_dll( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEXT *context )
{
struct dwarf_eh_bases bases;
+#if defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__) || !defined(__clang__)
const struct dwarf_fde *fde = _Unwind_Find_FDE( (void *)(context->Rip - 1), &bases );
if (fde)
return dwarf_virtual_unwind( context->Rip, &dispatch->EstablisherFrame, context, fde,
&bases, &dispatch->LanguageHandler, &dispatch->HandlerData );
+#endif
#ifdef HAVE_LIBUNWIND
return libunwind_virtual_unwind( context->Rip, &dispatch->EstablisherFrame, context,
&dispatch->LanguageHandler, &dispatch->HandlerData );
@@ -123,8 +123,8 @@ IDEPEND="app-eselect/eselect-wine"
QA_TEXTRELS="usr/lib/*/wine/i386-unix/*.so" # uses -fno-PIC -Wl,-z,notext
PATCHES=(
"${FILESDIR}"/${PN}-7.0-llvm-libunwind.patch
"${FILESDIR}"/${PN}-7.0-noexecstack.patch
"${FILESDIR}"/${PN}-7.0-unwind.patch
)
pkg_pretend() {
@@ -122,8 +122,8 @@ IDEPEND="app-eselect/eselect-wine"
QA_TEXTRELS="usr/lib/*/wine/i386-unix/*.so" # uses -fno-PIC -Wl,-z,notext
PATCHES=(
"${FILESDIR}"/${PN}-7.0-llvm-libunwind.patch
"${FILESDIR}"/${PN}-7.0-noexecstack.patch
"${FILESDIR}"/${PN}-7.0-unwind.patch
)
pkg_pretend() {
@@ -122,8 +122,8 @@ IDEPEND="app-eselect/eselect-wine"
QA_TEXTRELS="usr/lib/*/wine/i386-unix/*.so" # uses -fno-PIC -Wl,-z,notext
PATCHES=(
"${FILESDIR}"/${PN}-7.0-llvm-libunwind.patch
"${FILESDIR}"/${PN}-7.0-noexecstack.patch
"${FILESDIR}"/${PN}-7.0-unwind.patch
)
pkg_pretend() {