Module: wine Branch: master Commit: 3e2a999013e71d5cb14cdd9662fd2444718cd70c URL: https://gitlab.winehq.org/wine/wine/-/commit/3e2a999013e71d5cb14cdd9662fd244...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Apr 30 14:52:35 2024 +0200
makefiles: Support building files for x86-64 architecture on ARM64EC.
Based on a patch by Jacek Caban.
---
configure | 19 +++++++++++++++++-- configure.ac | 14 ++++++++++++-- tools/makedep.c | 26 ++++++++++++++++++++++---- 3 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/configure b/configure index 2b4597a72d9..e94c59ad767 100755 --- a/configure +++ b/configure @@ -10310,7 +10310,16 @@ saved_CC=$CC saved_CFLAGS=$CFLAGS saved_LDFLAGS=$LDFLAGS
-for wine_arch in $cross_archs +{ extra_arch=; unset extra_arch;} +for arch in $cross_archs +do + case $arch in + arm64ec) test ${extra_arch+y} || extra_arch=x86_64 ;; + x86_64) extra_arch="" ;; + esac +done + +for wine_arch in $cross_archs $extra_arch do case "x$with_mingw" in xclang|x*/clang) eval "${wine_arch}_CC=$with_mingw" ;; @@ -10840,7 +10849,13 @@ fi fi fi
- as_fn_append PE_ARCHS " $wine_arch" + if test "x$wine_arch" = x$extra_arch +then : + +else $as_nop + as_fn_append PE_ARCHS " $wine_arch" +fi + { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-fno-strict-aliasing" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5 printf %s "checking whether $CC supports -fno-strict-aliasing... " >&6; } diff --git a/configure.ac b/configure.ac index b03bb12f303..834b1535b2d 100644 --- a/configure.ac +++ b/configure.ac @@ -793,7 +793,16 @@ saved_CC=$CC saved_CFLAGS=$CFLAGS saved_LDFLAGS=$LDFLAGS
-for wine_arch in $cross_archs +AS_UNSET(extra_arch) +for arch in $cross_archs +do + case $arch in + arm64ec) test ${extra_arch+y} || extra_arch=x86_64 ;; + x86_64) extra_arch="" ;; + esac +done + +for wine_arch in $cross_archs $extra_arch do case "x$with_mingw" in xclang|x*/clang) AS_VAR_SET(${wine_arch}_CC,$with_mingw) ;; @@ -925,7 +934,8 @@ This is an error since --enable-archs=$wine_arch was requested.])]) This is an error since --enable-archs=$wine_arch was requested.])]) continue])])
- AS_VAR_APPEND([PE_ARCHS],[" $wine_arch"]) + AS_VAR_IF([wine_arch],[$extra_arch],[],[AS_VAR_APPEND([PE_ARCHS],[" $wine_arch"])]) + WINE_TRY_PE_CFLAGS([-fno-strict-aliasing]) dnl clang needs to be told to fail on unknown options WINE_TRY_PE_CFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"]) diff --git a/tools/makedep.c b/tools/makedep.c index 77cf6e476bb..f22552f8400 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -101,6 +101,7 @@ struct incl_file #define FLAG_C_IMPLIB 0x040000 /* file is part of an import library */ #define FLAG_C_UNIX 0x080000 /* file is part of a Unix library */ #define FLAG_SFD_FONTS 0x100000 /* sfd file generated bitmap fonts */ +#define FLAG_ARM64EC_X64 0x200000 /* use x86_64 object on ARM64EC */
static const struct { @@ -984,6 +985,7 @@ static void parse_pragma_directive( struct file *source, char *str ) { if (!strcmp( flag, "implib" )) source->flags |= FLAG_C_IMPLIB; if (!strcmp( flag, "unix" )) source->flags |= FLAG_C_UNIX; + if (!strcmp( flag, "arm64ec_x64" )) source->flags |= FLAG_ARM64EC_X64; } } } @@ -3185,7 +3187,8 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou struct strarray defines, struct strarray *targets, unsigned int arch ) { - const char *obj_name; + const char *obj_name, *var_cc, *var_cflags; + struct strarray arch_cflags = empty_strarray;
if (make->disabled[arch] && !(source->file->flags & FLAG_C_IMPLIB)) return;
@@ -3216,11 +3219,26 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou else strarray_add( &make->clean_files, obj_name );
+ if ((source->file->flags & FLAG_ARM64EC_X64) && !strcmp( archs.str[arch], "arm64ec" )) + { + var_cc = "$(x86_64_CC)"; + var_cflags = "$(x86_64_CFLAGS)"; + strarray_add( &arch_cflags, "-D__arm64ec_x64__" ); + strarray_addall( &arch_cflags, get_expanded_make_var_array( top_makefile, "x86_64_EXTRACFLAGS" )); + } + else + { + var_cc = arch_make_variable( "CC", arch ); + var_cflags = arch_make_variable( "CFLAGS", arch ); + strarray_addall( &arch_cflags, make->extlib ? extra_cflags_extlib[arch] : extra_cflags[arch] ); + } + output( "%s: %s\n", obj_dir_path( make, obj_name ), source->filename ); - output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), arch_make_variable( "CC", arch ), source->filename ); + output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), var_cc, source->filename ); output_filenames( defines ); if (!source->use_msvcrt) output_filenames( make->unix_cflags ); - output_filenames( make->extlib ? extra_cflags_extlib[arch] : extra_cflags[arch] ); + output_filenames( arch_cflags ); + if (!arch) { if (source->file->flags & FLAG_C_UNIX) @@ -3241,7 +3259,7 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou }
output_filenames( cpp_flags ); - output_filename( arch_make_variable( "CFLAGS", arch )); + output_filename( var_cflags ); output( "\n" );
if (make->testdll && strendswith( source->name, ".c" ) &&