makefiles: Build with -fno-PIC on i386.
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. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37540 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47027 Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7c0385bdb4
commit
8f732c66ab
|
@ -9278,7 +9278,12 @@ fi
|
|||
;;
|
||||
|
||||
*)
|
||||
DLLFLAGS="$DLLFLAGS -fPIC"
|
||||
case $host_cpu in
|
||||
*i[3456789]86*)
|
||||
DLLFLAGS="$DLLFLAGS -fno-PIC" ;;
|
||||
*)
|
||||
DLLFLAGS="$DLLFLAGS -fPIC" ;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can build a GNU style ELF dll" >&5
|
||||
$as_echo_n "checking whether we can build a GNU style ELF dll... " >&6; }
|
||||
if ${ac_cv_c_dll_gnuelf+:} false; then :
|
||||
|
@ -9304,121 +9309,121 @@ $as_echo "$ac_cv_c_dll_gnuelf" >&6; }
|
|||
if test "$ac_cv_c_dll_gnuelf" = "yes"
|
||||
then
|
||||
LIBWINE_LDFLAGS="-shared"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -shared -Wl,-soname,confest.so.1" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fPIC -shared -Wl,-soname,confest.so.1... " >&6; }
|
||||
if ${ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1+:} false; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -shared -Wl,-soname,confest.so.1" >&5
|
||||
$as_echo_n "checking whether the compiler supports -shared -Wl,-soname,confest.so.1... " >&6; }
|
||||
if ${ac_cv_cflags__shared__Wl__soname_confest_so_1+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,confest.so.1"
|
||||
CFLAGS="$CFLAGS -shared -Wl,-soname,confest.so.1"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1=yes
|
||||
ac_cv_cflags__shared__Wl__soname_confest_so_1=yes
|
||||
else
|
||||
ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1=no
|
||||
ac_cv_cflags__shared__Wl__soname_confest_so_1=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ac_wine_try_cflags_saved
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1" >&5
|
||||
$as_echo "$ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1" >&6; }
|
||||
if test "x$ac_cv_cflags__fPIC__shared__Wl__soname_confest_so_1" = xyes; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__shared__Wl__soname_confest_so_1" >&5
|
||||
$as_echo "$ac_cv_cflags__shared__Wl__soname_confest_so_1" >&6; }
|
||||
if test "x$ac_cv_cflags__shared__Wl__soname_confest_so_1" = xyes; then :
|
||||
LIBWINE_LDFLAGS="-shared -Wl,-soname,libwine.so.$libwine_soversion"
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -shared -Wl,-h,confest.so.1" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fPIC -shared -Wl,-h,confest.so.1... " >&6; }
|
||||
if ${ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1+:} false; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -shared -Wl,-h,confest.so.1" >&5
|
||||
$as_echo_n "checking whether the compiler supports -shared -Wl,-h,confest.so.1... " >&6; }
|
||||
if ${ac_cv_cflags__shared__Wl__h_confest_so_1+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fPIC -shared -Wl,-h,confest.so.1"
|
||||
CFLAGS="$CFLAGS -shared -Wl,-h,confest.so.1"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1=yes
|
||||
ac_cv_cflags__shared__Wl__h_confest_so_1=yes
|
||||
else
|
||||
ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1=no
|
||||
ac_cv_cflags__shared__Wl__h_confest_so_1=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ac_wine_try_cflags_saved
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1" >&5
|
||||
$as_echo "$ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1" >&6; }
|
||||
if test "x$ac_cv_cflags__fPIC__shared__Wl__h_confest_so_1" = xyes; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__shared__Wl__h_confest_so_1" >&5
|
||||
$as_echo "$ac_cv_cflags__shared__Wl__h_confest_so_1" >&6; }
|
||||
if test "x$ac_cv_cflags__shared__Wl__h_confest_so_1" = xyes; then :
|
||||
LIBWINE_LDFLAGS="-shared -Wl,-h,libwine.so.$libwine_soversion"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '{ global: *; };' >conftest.map
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -shared -Wl,--version-script=conftest.map" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fPIC -shared -Wl,--version-script=conftest.map... " >&6; }
|
||||
if ${ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map+:} false; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -shared -Wl,--version-script=conftest.map" >&5
|
||||
$as_echo_n "checking whether the compiler supports -shared -Wl,--version-script=conftest.map... " >&6; }
|
||||
if ${ac_cv_cflags__shared__Wl___version_script_conftest_map+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fPIC -shared -Wl,--version-script=conftest.map"
|
||||
CFLAGS="$CFLAGS -shared -Wl,--version-script=conftest.map"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map=yes
|
||||
ac_cv_cflags__shared__Wl___version_script_conftest_map=yes
|
||||
else
|
||||
ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map=no
|
||||
ac_cv_cflags__shared__Wl___version_script_conftest_map=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ac_wine_try_cflags_saved
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map" >&5
|
||||
$as_echo "$ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map" >&6; }
|
||||
if test "x$ac_cv_cflags__fPIC__shared__Wl___version_script_conftest_map" = xyes; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__shared__Wl___version_script_conftest_map" >&5
|
||||
$as_echo "$ac_cv_cflags__shared__Wl___version_script_conftest_map" >&6; }
|
||||
if test "x$ac_cv_cflags__shared__Wl___version_script_conftest_map" = xyes; then :
|
||||
LIBWINE_LDFLAGS="$LIBWINE_LDFLAGS -Wl,--version-script=\$(srcdir)/wine.map"
|
||||
fi
|
||||
rm -f conftest.map
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -Wl,--export-dynamic" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fPIC -Wl,--export-dynamic... " >&6; }
|
||||
if ${ac_cv_cflags__fPIC__Wl___export_dynamic+:} false; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--export-dynamic" >&5
|
||||
$as_echo_n "checking whether the compiler supports -Wl,--export-dynamic... " >&6; }
|
||||
if ${ac_cv_cflags__Wl___export_dynamic+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fPIC -Wl,--export-dynamic"
|
||||
CFLAGS="$CFLAGS -Wl,--export-dynamic"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_cflags__fPIC__Wl___export_dynamic=yes
|
||||
ac_cv_cflags__Wl___export_dynamic=yes
|
||||
else
|
||||
ac_cv_cflags__fPIC__Wl___export_dynamic=no
|
||||
ac_cv_cflags__Wl___export_dynamic=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ac_wine_try_cflags_saved
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__Wl___export_dynamic" >&5
|
||||
$as_echo "$ac_cv_cflags__fPIC__Wl___export_dynamic" >&6; }
|
||||
if test "x$ac_cv_cflags__fPIC__Wl___export_dynamic" = xyes; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___export_dynamic" >&5
|
||||
$as_echo "$ac_cv_cflags__Wl___export_dynamic" >&6; }
|
||||
if test "x$ac_cv_cflags__Wl___export_dynamic" = xyes; then :
|
||||
WINELOADER_LDFLAGS="-Wl,--export-dynamic"
|
||||
fi
|
||||
WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000"
|
||||
|
||||
as_ac_var=`$as_echo "ac_cv_cflags_-fPIC -Wl,--rpath,\\$ORIGIN/../lib" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -Wl,--rpath,\$ORIGIN/../lib" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fPIC -Wl,--rpath,\$ORIGIN/../lib... " >&6; }
|
||||
as_ac_var=`$as_echo "ac_cv_cflags_-Wl,--rpath,\\$ORIGIN/../lib" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--rpath,\$ORIGIN/../lib" >&5
|
||||
$as_echo_n "checking whether the compiler supports -Wl,--rpath,\$ORIGIN/../lib... " >&6; }
|
||||
if eval \${$as_ac_var+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fPIC -Wl,--rpath,\$ORIGIN/../lib"
|
||||
CFLAGS="$CFLAGS -Wl,--rpath,\$ORIGIN/../lib"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
|
@ -9439,14 +9444,14 @@ if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
|||
LDRPATH_INSTALL="-Wl,--rpath,\\\$\$ORIGIN/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`"
|
||||
LDRPATH_LOCAL="-Wl,--rpath,\\\$\$ORIGIN/\$(top_builddir)/libs/wine"
|
||||
else
|
||||
as_ac_var=`$as_echo "ac_cv_cflags_-fPIC -Wl,-R,\\$ORIGIN/../lib" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -Wl,-R,\$ORIGIN/../lib" >&5
|
||||
$as_echo_n "checking whether the compiler supports -fPIC -Wl,-R,\$ORIGIN/../lib... " >&6; }
|
||||
as_ac_var=`$as_echo "ac_cv_cflags_-Wl,-R,\\$ORIGIN/../lib" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-R,\$ORIGIN/../lib" >&5
|
||||
$as_echo_n "checking whether the compiler supports -Wl,-R,\$ORIGIN/../lib... " >&6; }
|
||||
if eval \${$as_ac_var+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_wine_try_cflags_saved=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fPIC -Wl,-R,\$ORIGIN/../lib"
|
||||
CFLAGS="$CFLAGS -Wl,-R,\$ORIGIN/../lib"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
int main(int argc, char **argv) { return 0; }
|
||||
|
|
19
configure.ac
19
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],
|
||||
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([-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([-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([-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([-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([-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([-Wl,-R,\$ORIGIN/../lib],
|
||||
[LDRPATH_INSTALL="-Wl,-R,\\\$\$ORIGIN/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`"
|
||||
LDRPATH_LOCAL="-Wl,-R,\\\$\$ORIGIN/\$(top_builddir)/libs/wine"])])
|
||||
|
||||
|
|
Loading…
Reference in New Issue