makedep: Use -Wl,-delayload on cross targets when supported by linker.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-11-13 17:49:42 +01:00 committed by Alexandre Julliard
parent cc53c1f77b
commit 3d19efae72
4 changed files with 48 additions and 5 deletions

View File

@ -70,6 +70,7 @@ CROSSTARGET = @CROSSTARGET@
SUBDIRS = @SUBDIRS@
RUNTESTFLAGS = -q -P wine
MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT)
DELAYLOADFLAG = @DELAYLOADFLAG@
PACKAGE_VERSION = @PACKAGE_VERSION@
SED_CMD = LC_ALL=C sed -e 's,@bindir\@,${bindir},g' -e 's,@dlldir\@,${dlldir},g' -e 's,@srcdir\@,${srcdir},g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' -e 's,@PACKAGE_VERSION\@,@PACKAGE_VERSION@,g'
LDRPATH_INSTALL = @LDRPATH_INSTALL@

28
configure vendored
View File

@ -706,6 +706,7 @@ X_PRE_LIBS
X_CFLAGS
XMKMF
PTHREAD_LIBS
DELAYLOADFLAG
EXTRACROSSCFLAGS
CROSSCFLAGS
CROSSCC
@ -10420,6 +10421,33 @@ fi ;;
esac
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-delayload,autoconftest.dll" >&5
$as_echo_n "checking whether the compiler supports -Wl,-delayload,autoconftest.dll... " >&6; }
if ${ac_cv_cflags__Wl__delayload_autoconftest_dll+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Wl,-delayload,autoconftest.dll"
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__Wl__delayload_autoconftest_dll=yes
else
ac_cv_cflags__Wl__delayload_autoconftest_dll=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__Wl__delayload_autoconftest_dll" >&5
$as_echo "$ac_cv_cflags__Wl__delayload_autoconftest_dll" >&6; }
if test "x$ac_cv_cflags__Wl__delayload_autoconftest_dll" = xyes; then :
DELAYLOADFLAG="-Wl,-delayload,"
fi
if test "x$enable_maintainer_mode" = xyes
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Werror" >&5

View File

@ -1085,6 +1085,8 @@ then
esac
done
WINE_TRY_CFLAGS([-Wl,-delayload,autoconftest.dll], [AC_SUBST(DELAYLOADFLAG,["-Wl,-delayload,"])])
if test "x$enable_maintainer_mode" = xyes
then
WINE_TRY_CROSSCFLAGS([-Werror])

View File

@ -164,6 +164,7 @@ static const char *dlltool;
static const char *msgfmt;
static const char *ln_s;
static const char *sed_cmd;
static const char *delay_load_flag;
struct makefile
{
@ -2110,14 +2111,17 @@ static struct makefile *get_parent_makefile( struct makefile *make )
*/
static int needs_cross_lib( const struct makefile *make )
{
const char *name;
if (!crosstarget) return 0;
if (make->importlib) return strarray_exists( &cross_import_libs, make->importlib );
if (make->staticlib)
if (make->importlib) name = make->importlib;
else if (make->staticlib)
{
const char *name = replace_extension( make->staticlib, ".a", "" );
name = replace_extension( make->staticlib, ".a", "" );
if (!strncmp( name, "lib", 3 )) name += 3;
return strarray_exists( &cross_import_libs, name );
}
else return 0;
if (strarray_exists( &cross_import_libs, name )) return 1;
if (delay_load_flag && strarray_exists( &delay_import_libs, name )) return 1;
return 0;
}
@ -2127,6 +2131,7 @@ static int needs_cross_lib( const struct makefile *make )
*/
static int needs_delay_lib( const struct makefile *make )
{
if (delay_load_flag) return 0;
if (*dll_ext && !crosstarget) return 0;
if (!make->importlib) return 0;
return strarray_exists( &delay_import_libs, make->importlib );
@ -2207,7 +2212,7 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra
if (lib)
{
if (delay) lib = replace_extension( lib, ".a", ".delay.a" );
if (delay && !delay_load_flag) lib = replace_extension( lib, ".a", ".delay.a" );
else if (make->is_cross) lib = replace_extension( lib, ".a", ".cross.a" );
lib = top_obj_dir_path( make, lib );
strarray_add( deps, lib );
@ -3212,6 +3217,12 @@ static void output_module( struct makefile *make )
if (make->is_cross)
{
if (delay_load_flag)
{
for (i = 0; i < make->delayimports.count; i++)
strarray_add( &all_libs, strmake( "%s%s%s", delay_load_flag, make->delayimports.str[i],
strchr( make->delayimports.str[i], '.' ) ? "" : ".dll" ));
}
strarray_add( &make->all_targets, strmake( "%s", make->module ));
add_install_rule( make, make->module, strmake( "%s", make->module ),
strmake( "c$(dlldir)/%s", make->module ));
@ -4357,6 +4368,7 @@ int main( int argc, char *argv[] )
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" );
delay_load_flag = get_expanded_make_variable( top_makefile, "DELAYLOADFLAG" );
top_install_lib = get_expanded_make_var_array( top_makefile, "TOP_INSTALL_LIB" );
top_install_dev = get_expanded_make_var_array( top_makefile, "TOP_INSTALL_DEV" );