makefiles: Also pass -fPIC flag when linking.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-04-30 22:42:17 +02:00
parent 8f732c66ab
commit 8039941c52
4 changed files with 22 additions and 12 deletions

View File

@ -44,7 +44,7 @@ EXTRACFLAGS = @EXTRACFLAGS@
EXTRACROSSCFLAGS= @EXTRACROSSCFLAGS@
MSVCRTFLAGS = @BUILTINFLAG@
TARGETFLAGS = @TARGETFLAGS@
UNWINDFLAGS = @UNWINDFLAGS@
LDDLLFLAGS = @LDDLLFLAGS@
LDEXECFLAGS = @LDEXECFLAGS@
LIBS = @LIBS@
BISON = @BISON@

15
configure vendored
View File

@ -631,7 +631,6 @@ RT_LIBS
POLL_LIBS
DL_LIBS
TOOLSEXT
UNWINDFLAGS
BUILTINFLAG
EXCESS_PRECISION_CFLAGS
EXTRACFLAGS
@ -743,6 +742,7 @@ WINELOADER_LDFLAGS
TOP_INSTALL_DEV
TOP_INSTALL_LIB
LDEXECFLAGS
LDDLLFLAGS
LDRPATH_LOCAL
LDRPATH_INSTALL
DLLFLAGS
@ -7849,6 +7849,8 @@ LDRPATH_INSTALL=""
LDRPATH_LOCAL=""
LDDLLFLAGS=""
LDEXECFLAGS=""
TOP_INSTALL_LIB=""
@ -8660,6 +8662,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
LIBEXT="dylib"
DLLFLAGS="$DLLFLAGS -fPIC"
LDDLLFLAGS="-fPIC"
LDRPATH_INSTALL="-Wl,-rpath,@loader_path/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`"
LDRPATH_LOCAL="-Wl,-rpath,@loader_path/\$(top_builddir)/libs/wine"
COREFOUNDATION_LIBS="-framework CoreFoundation"
@ -9038,6 +9041,7 @@ fi
linux-android*)
DLLFLAGS="$DLLFLAGS -fPIC"
LDDLLFLAGS="-fPIC"
LDEXECFLAGS="-Wl,-pie"
enable_wineandroid_drv=${enable_wineandroid_drv:-yes}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -Wl,--export-dynamic" >&5
@ -9280,9 +9284,11 @@ fi
*)
case $host_cpu in
*i[3456789]86*)
DLLFLAGS="$DLLFLAGS -fno-PIC" ;;
DLLFLAGS="$DLLFLAGS -fno-PIC"
LDDLLFLAGS="-fno-PIC" ;;
*)
DLLFLAGS="$DLLFLAGS -fPIC" ;;
DLLFLAGS="$DLLFLAGS -fPIC"
LDDLLFLAGS="-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; }
@ -17548,8 +17554,7 @@ then
$as_echo "#define __ASM_CFI(str) str" >>confdefs.h
UNWINDFLAGS=-fasynchronous-unwind-tables
LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables"
else
$as_echo "#define __ASM_CFI(str) \"\"" >>confdefs.h

View File

@ -707,6 +707,7 @@ dnl **** Check for working dll ****
AC_SUBST(DLLFLAGS,"-D_REENTRANT")
AC_SUBST(LDRPATH_INSTALL,"")
AC_SUBST(LDRPATH_LOCAL,"")
AC_SUBST(LDDLLFLAGS,"")
AC_SUBST(LDEXECFLAGS,"")
AC_SUBST(TOP_INSTALL_LIB,"")
AC_SUBST(TOP_INSTALL_DEV,"")
@ -746,6 +747,7 @@ case $host_os in
AC_LANG_POP([Objective C])
LIBEXT="dylib"
DLLFLAGS="$DLLFLAGS -fPIC"
LDDLLFLAGS="-fPIC"
LDRPATH_INSTALL="-Wl,-rpath,@loader_path/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`"
LDRPATH_LOCAL="-Wl,-rpath,@loader_path/\$(top_builddir)/libs/wine"
dnl declare needed frameworks
@ -891,6 +893,7 @@ case $host_os in
linux-android*)
DLLFLAGS="$DLLFLAGS -fPIC"
LDDLLFLAGS="-fPIC"
LDEXECFLAGS="-Wl,-pie"
enable_wineandroid_drv=${enable_wineandroid_drv:-yes}
WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic],
@ -926,9 +929,11 @@ case $host_os in
*)
case $host_cpu in
*i[[3456789]]86*)
DLLFLAGS="$DLLFLAGS -fno-PIC" ;;
DLLFLAGS="$DLLFLAGS -fno-PIC"
LDDLLFLAGS="-fno-PIC" ;;
*)
DLLFLAGS="$DLLFLAGS -fPIC" ;;
DLLFLAGS="$DLLFLAGS -fPIC"
LDDLLFLAGS="-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],
@ -2137,7 +2142,7 @@ then
asm_func_header="$asm_func_header.cfi_startproc\\n\\t"
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])
LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables"
else
AC_DEFINE([__ASM_CFI(str)],[""])
if test "x$enable_win64" = "xyes"

View File

@ -134,7 +134,7 @@ static struct strarray msvcrt_flags;
static struct strarray extra_cflags;
static struct strarray extra_cross_cflags;
static struct strarray cpp_flags;
static struct strarray unwind_flags;
static struct strarray lddll_flags;
static struct strarray libs;
static struct strarray enable_tests;
static struct strarray cmdline_vars;
@ -2282,7 +2282,7 @@ static void output_winegcc_command( struct makefile *make, int cross )
else
{
output_filenames( target_flags );
output_filenames( unwind_flags );
output_filenames( lddll_flags );
}
}
@ -4201,7 +4201,7 @@ int main( int argc, char *argv[] )
extra_cflags = get_expanded_make_var_array( top_makefile, "EXTRACFLAGS" );
extra_cross_cflags = get_expanded_make_var_array( top_makefile, "EXTRACROSSCFLAGS" );
cpp_flags = get_expanded_make_var_array( top_makefile, "CPPFLAGS" );
unwind_flags = get_expanded_make_var_array( top_makefile, "UNWINDFLAGS" );
lddll_flags = get_expanded_make_var_array( top_makefile, "LDDLLFLAGS" );
libs = get_expanded_make_var_array( top_makefile, "LIBS" );
enable_tests = get_expanded_make_var_array( top_makefile, "ENABLE_TESTS" );
top_install_lib = get_expanded_make_var_array( top_makefile, "TOP_INSTALL_LIB" );