Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37540 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47027
Many applications attempt to hook or copy native API calls, using methods sophisticated enough to recognize any sequence of x86 instructions, but not enough to recognize and account for a GOT register load. Most such cases only care to insert a JMP instruction in the first five bytes, and so are satisfied by adding the hot-patch prefix. However, the madCodeHook 3.x engine attempts to copy the first 15 bytes, and some copy-protection schemes will try to copy the whole function.
Building with -fno-PIC on i386, as is the default behaviour for Visual Studio compiled applications, and likely for Windows libraries as well, fixes those applications, and also stops us once and for all wasting time debugging and individually applying DECLSPEC_HOTPATCH.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- configure.ac | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac index 8de9d3723e..a200e73a2f 100644 --- a/configure.ac +++ b/configure.ac @@ -924,31 +924,36 @@ case $host_os in ;;
*) - DLLFLAGS="$DLLFLAGS -fPIC" + case $host_cpu in + *i[[3456789]]86*) + DLLFLAGS="$DLLFLAGS -fno-PIC" ;; + *) + DLLFLAGS="$DLLFLAGS -fPIC" ;; + esac AC_CACHE_CHECK([whether we can build a GNU style ELF dll], ac_cv_c_dll_gnuelf, - [WINE_TRY_SHLIB_FLAGS([-fPIC -shared -Wl,-Bsymbolic], + [WINE_TRY_SHLIB_FLAGS([$DLLFLAGS -shared -Wl,-Bsymbolic], ac_cv_c_dll_gnuelf="yes",ac_cv_c_dll_gnuelf="no")]) if test "$ac_cv_c_dll_gnuelf" = "yes" then LIBWINE_LDFLAGS="-shared" - WINE_TRY_CFLAGS([-fPIC -shared -Wl,-soname,confest.so.1], + WINE_TRY_CFLAGS([$DLLFLAGS -shared -Wl,-soname,confest.so.1], [LIBWINE_LDFLAGS="-shared -Wl,-soname,libwine.so.$libwine_soversion"], - [WINE_TRY_CFLAGS([-fPIC -shared -Wl,-h,confest.so.1], + [WINE_TRY_CFLAGS([$DLLFLAGS -shared -Wl,-h,confest.so.1], [LIBWINE_LDFLAGS="-shared -Wl,-h,libwine.so.$libwine_soversion"])])
echo '{ global: *; };' >conftest.map - WINE_TRY_CFLAGS([-fPIC -shared -Wl,--version-script=conftest.map], + WINE_TRY_CFLAGS([$DLLFLAGS -shared -Wl,--version-script=conftest.map], [LIBWINE_LDFLAGS="$LIBWINE_LDFLAGS -Wl,--version-script=$(srcdir)/wine.map"]) rm -f conftest.map
- WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic], + WINE_TRY_CFLAGS([$DLLFLAGS -Wl,--export-dynamic], [WINELOADER_LDFLAGS="-Wl,--export-dynamic"]) WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000"
- WINE_TRY_CFLAGS([-fPIC -Wl,--rpath,$ORIGIN/../lib], + WINE_TRY_CFLAGS([$DLLFLAGS -Wl,--rpath,$ORIGIN/../lib], [LDRPATH_INSTALL="-Wl,--rpath,\$$ORIGIN/`$(MAKEDEP) -R ${bindir} ${libdir}`" LDRPATH_LOCAL="-Wl,--rpath,\$$ORIGIN/$(top_builddir)/libs/wine"], - [WINE_TRY_CFLAGS([-fPIC -Wl,-R,$ORIGIN/../lib], + [WINE_TRY_CFLAGS([$DLLFLAGS -Wl,-R,$ORIGIN/../lib], [LDRPATH_INSTALL="-Wl,-R,\$$ORIGIN/`$(MAKEDEP) -R ${bindir} ${libdir}`" LDRPATH_LOCAL="-Wl,-R,\$$ORIGIN/$(top_builddir)/libs/wine"])])