diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index e9437628002..fa9276402bf 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -358,6 +358,7 @@ extern const char *output_file_name; extern char **lib_path; extern struct strarray *as_command; +extern struct strarray *cc_command; extern struct strarray *ld_command; extern struct strarray *nm_command; extern char *cpu_option; diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index de526a9825c..a848a0cadae 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -85,6 +85,7 @@ static const char *output_file_source_name; static int fake_module; struct strarray *as_command = NULL; +struct strarray *cc_command = NULL; struct strarray *ld_command = NULL; struct strarray *nm_command = NULL; char *cpu_option = NULL; @@ -241,6 +242,7 @@ static const char usage_str[] = "Options:\n" " --as-cmd=AS Command to use for assembling (default: as)\n" " -b, --target=TARGET Specify target CPU and platform for cross-compiling\n" +" --cc-cmd=CC C compiler to use for assembling (default: fall back to --as-cmd)\n" " -d, --delay-lib=LIB Import the specified library in delayed mode\n" " -D SYM Ignored for C flags compatibility\n" " -e, --entry=FUNC Set the DLL entry point function (default: DllMain)\n" @@ -286,6 +288,7 @@ enum long_options_values LONG_OPT_EXE, LONG_OPT_IMPLIB, LONG_OPT_ASCMD, + LONG_OPT_CCCMD, LONG_OPT_EXTERNAL_SYMS, LONG_OPT_FAKE_MODULE, LONG_OPT_LARGE_ADDRESS_AWARE, @@ -307,6 +310,7 @@ static const struct option long_options[] = { "exe", 0, 0, LONG_OPT_EXE }, { "implib", 0, 0, LONG_OPT_IMPLIB }, { "as-cmd", 1, 0, LONG_OPT_ASCMD }, + { "cc-cmd", 1, 0, LONG_OPT_CCCMD }, { "external-symbols", 0, 0, LONG_OPT_EXTERNAL_SYMS }, { "fake-module", 0, 0, LONG_OPT_FAKE_MODULE }, { "large-address-aware", 0, 0, LONG_OPT_LARGE_ADDRESS_AWARE }, @@ -476,6 +480,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec ) case LONG_OPT_ASCMD: as_command = strarray_fromstring( optarg, " " ); break; + case LONG_OPT_CCCMD: + cc_command = strarray_fromstring( optarg, " " ); + break; case LONG_OPT_FAKE_MODULE: fake_module = 1; break; diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index d064572ab55..2028b05745b 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -373,13 +373,15 @@ struct strarray *find_tool( const char *name, const char * const *names ) struct strarray *get_as_command(void) { - static int as_is_clang = 0; struct strarray *args; - if (!as_command) + if (cc_command) { - as_command = find_tool( "clang", NULL ); - if (as_command) as_is_clang = 1; + args = strarray_copy( cc_command ); + strarray_add( args, "-xassembler", "-c", NULL ); + if (force_pointer_size) + strarray_add_one( args, (force_pointer_size == 8) ? "-m64" : "-m32" ); + return args; } if (!as_command) @@ -393,13 +395,7 @@ struct strarray *get_as_command(void) args = strarray_copy( as_command ); - if (as_is_clang) - { - strarray_add( args, "-xassembler", "-c", NULL ); - if (force_pointer_size) - strarray_add_one( args, (force_pointer_size == 8) ? "-m64" : "-m32" ); - } - else if (force_pointer_size) + if (force_pointer_size) { switch (target_platform) { diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in index 59debd4afaf..3762b742ac2 100644 --- a/tools/winebuild/winebuild.man.in +++ b/tools/winebuild/winebuild.man.in @@ -67,6 +67,10 @@ Specify the target CPU and platform on which the generated code will be built. The target specification is in the standard autoconf format as returned by config.sub. .TP +.BI \--cc-cmd= cc-command +Specify the C compiler to use to compile assembly files; the default +is to instead use the assembler specified with \fB--as-cmd\fR. +.TP .BI \-d,\ --delay-lib= name Set the delayed import mode for the specified library, which must be one of the libraries imported with the \fB-l\fR option. Delayed mode