[PATCH] ntdll: link libunwind if present

Marcus Meissner marcus at jet.franken.de
Sat Jun 13 05:17:20 CDT 2015


On openSUSE 13.1/13.2 otherwise ntdll x86_64 build will fail with:

../../tools/winegcc/winegcc -o ntdll.dll.so -B../../tools/winebuild -m64 -fasynchronous-unwind-tables -shared /home/marcus/projects/wine/dlls/ntdll/ntdll.spec \
  -nodefaultlibs -Wl,--image-base,0x7bc00000 actctx.o atom.o cdrom.o critsection.o debugbuffer.o \
  debugtools.o directory.o env.o error.o exception.o file.o handletable.o heap.o large_int.o \
  loader.o loadorder.o misc.o nt.o om.o path.o printf.o process.o reg.o relay.o resource.o rtl.o \
  rtlbitmap.o rtlstr.o sec.o serial.o server.o signal_arm.o signal_arm64.o signal_i386.o \
  signal_powerpc.o signal_x86_64.o string.o sync.o tape.o thread.o threadpool.o time.o version.o \
  virtual.o wcstring.o version.res -lwinecrt0 -lwine ../../libs/port/libwine_port.a -lpthread \

signal_x86_64.o: In function `libunwind_virtual_unwind':
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1554: undefined reference to `_Ux86_64_getcontext'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1556: undefined reference to `_ULx86_64_init_local'
signal_x86_64.o: In function `libunwind_set_cursor_from_context':
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1442: undefined reference to `_ULx86_64_set_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1444: undefined reference to `_ULx86_64_set_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1446: undefined reference to `_ULx86_64_set_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1448: undefined reference to `_ULx86_64_set_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1450: undefined reference to `_ULx86_64_set_reg'
signal_x86_64.o:/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1452: more undefined references to `_ULx86_64_set_reg' follow
signal_x86_64.o: In function `libunwind_virtual_unwind':
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1565: undefined reference to `_ULx86_64_get_proc_info'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1581: undefined reference to `_ULx86_64_step'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1488: undefined reference to `_ULx86_64_get_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1488: undefined reference to `_ULx86_64_get_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1488: undefined reference to `_ULx86_64_get_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1488: undefined reference to `_ULx86_64_get_reg'
/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1488: undefined reference to `_ULx86_64_get_reg'
signal_x86_64.o:/home/marcus/projects/wine/dlls/ntdll/signal_x86_64.c:1488: more undefined references to `_ULx86_64_get_reg' follow
collect2: error: ld returned 1 exit status

(probably on x86 it all is inlined, but this is not the case for x86_64)
---
 configure.ac           | 3 +++
 dlls/ntdll/Makefile.in | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index df28b27..97b335d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1974,6 +1974,7 @@ AC_CACHE_CHECK([whether CFI directives are supported in assembly code], ac_cv_c_
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\nac_test:\t.cfi_startproc\n\t.long 0\n\t.cfi_endproc");]])],
                       ac_cv_c_cfi_support="yes",ac_cv_c_cfi_support="no"))
 
+UNWIND_LIBS=
 asm_func_header=".globl $asm_name_prefix\" #name suffix \"\\n\\t$asm_func_header\\n$asm_name_prefix\" #name suffix \":\\n\\t"
 asm_func_trailer=""
 if test "$ac_cv_c_dot_previous" = "yes"
@@ -1986,6 +1987,7 @@ then
    asm_func_trailer="\\n\\t.cfi_endproc$asm_func_trailer"
    AC_DEFINE([__ASM_CFI(str)],[str],[Define to a macro to output a .cfi assembly pseudo-op])
    AC_SUBST([UNWINDFLAGS],[-fasynchronous-unwind-tables])
+   AC_CHECK_LIB(unwind,_U_dyn_register,[UNWIND_LIBS="-lunwind"])
 else
    AC_DEFINE([__ASM_CFI(str)],[""])
    if test "x$enable_win64" = "xyes"
@@ -1993,6 +1995,7 @@ else
       WINE_WARNING([building 64-bit Wine without support for CFI directives; exception handling will not work properly.])
    fi
 fi
+AC_SUBST(UNWIND_LIBS)
 
 asm_func_code="$asm_func_header\" code \"$asm_func_trailer"
 
diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
index ed4bb94..08f094a 100644
--- a/dlls/ntdll/Makefile.in
+++ b/dlls/ntdll/Makefile.in
@@ -2,7 +2,7 @@ EXTRADEFS = -D_NTSYSTEM_
 MODULE    = ntdll.dll
 IMPORTLIB = ntdll
 IMPORTS   = winecrt0
-EXTRALIBS = $(IOKIT_LIBS) $(RT_LIBS) $(PTHREAD_LIBS)
+EXTRALIBS = $(IOKIT_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS)
 EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000
 
 C_SRCS = \
-- 
1.8.4.5




More information about the wine-patches mailing list