Commit 98e6a0da authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Add an option to use the C compiler to assemble files.

parent f7272176
...@@ -358,6 +358,7 @@ extern const char *output_file_name; ...@@ -358,6 +358,7 @@ extern const char *output_file_name;
extern char **lib_path; extern char **lib_path;
extern struct strarray *as_command; extern struct strarray *as_command;
extern struct strarray *cc_command;
extern struct strarray *ld_command; extern struct strarray *ld_command;
extern struct strarray *nm_command; extern struct strarray *nm_command;
extern char *cpu_option; extern char *cpu_option;
......
...@@ -85,6 +85,7 @@ static const char *output_file_source_name; ...@@ -85,6 +85,7 @@ static const char *output_file_source_name;
static int fake_module; static int fake_module;
struct strarray *as_command = NULL; struct strarray *as_command = NULL;
struct strarray *cc_command = NULL;
struct strarray *ld_command = NULL; struct strarray *ld_command = NULL;
struct strarray *nm_command = NULL; struct strarray *nm_command = NULL;
char *cpu_option = NULL; char *cpu_option = NULL;
...@@ -241,6 +242,7 @@ static const char usage_str[] = ...@@ -241,6 +242,7 @@ static const char usage_str[] =
"Options:\n" "Options:\n"
" --as-cmd=AS Command to use for assembling (default: as)\n" " --as-cmd=AS Command to use for assembling (default: as)\n"
" -b, --target=TARGET Specify target CPU and platform for cross-compiling\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, --delay-lib=LIB Import the specified library in delayed mode\n"
" -D SYM Ignored for C flags compatibility\n" " -D SYM Ignored for C flags compatibility\n"
" -e, --entry=FUNC Set the DLL entry point function (default: DllMain)\n" " -e, --entry=FUNC Set the DLL entry point function (default: DllMain)\n"
...@@ -286,6 +288,7 @@ enum long_options_values ...@@ -286,6 +288,7 @@ enum long_options_values
LONG_OPT_EXE, LONG_OPT_EXE,
LONG_OPT_IMPLIB, LONG_OPT_IMPLIB,
LONG_OPT_ASCMD, LONG_OPT_ASCMD,
LONG_OPT_CCCMD,
LONG_OPT_EXTERNAL_SYMS, LONG_OPT_EXTERNAL_SYMS,
LONG_OPT_FAKE_MODULE, LONG_OPT_FAKE_MODULE,
LONG_OPT_LARGE_ADDRESS_AWARE, LONG_OPT_LARGE_ADDRESS_AWARE,
...@@ -307,6 +310,7 @@ static const struct option long_options[] = ...@@ -307,6 +310,7 @@ static const struct option long_options[] =
{ "exe", 0, 0, LONG_OPT_EXE }, { "exe", 0, 0, LONG_OPT_EXE },
{ "implib", 0, 0, LONG_OPT_IMPLIB }, { "implib", 0, 0, LONG_OPT_IMPLIB },
{ "as-cmd", 1, 0, LONG_OPT_ASCMD }, { "as-cmd", 1, 0, LONG_OPT_ASCMD },
{ "cc-cmd", 1, 0, LONG_OPT_CCCMD },
{ "external-symbols", 0, 0, LONG_OPT_EXTERNAL_SYMS }, { "external-symbols", 0, 0, LONG_OPT_EXTERNAL_SYMS },
{ "fake-module", 0, 0, LONG_OPT_FAKE_MODULE }, { "fake-module", 0, 0, LONG_OPT_FAKE_MODULE },
{ "large-address-aware", 0, 0, LONG_OPT_LARGE_ADDRESS_AWARE }, { "large-address-aware", 0, 0, LONG_OPT_LARGE_ADDRESS_AWARE },
...@@ -476,6 +480,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec ) ...@@ -476,6 +480,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
case LONG_OPT_ASCMD: case LONG_OPT_ASCMD:
as_command = strarray_fromstring( optarg, " " ); as_command = strarray_fromstring( optarg, " " );
break; break;
case LONG_OPT_CCCMD:
cc_command = strarray_fromstring( optarg, " " );
break;
case LONG_OPT_FAKE_MODULE: case LONG_OPT_FAKE_MODULE:
fake_module = 1; fake_module = 1;
break; break;
......
...@@ -373,13 +373,15 @@ struct strarray *find_tool( const char *name, const char * const *names ) ...@@ -373,13 +373,15 @@ struct strarray *find_tool( const char *name, const char * const *names )
struct strarray *get_as_command(void) struct strarray *get_as_command(void)
{ {
static int as_is_clang = 0;
struct strarray *args; struct strarray *args;
if (!as_command) if (cc_command)
{ {
as_command = find_tool( "clang", NULL ); args = strarray_copy( cc_command );
if (as_command) as_is_clang = 1; 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) if (!as_command)
...@@ -393,13 +395,7 @@ struct strarray *get_as_command(void) ...@@ -393,13 +395,7 @@ struct strarray *get_as_command(void)
args = strarray_copy( as_command ); args = strarray_copy( as_command );
if (as_is_clang)
{
strarray_add( args, "-xassembler", "-c", NULL );
if (force_pointer_size) if (force_pointer_size)
strarray_add_one( args, (force_pointer_size == 8) ? "-m64" : "-m32" );
}
else if (force_pointer_size)
{ {
switch (target_platform) switch (target_platform)
{ {
......
...@@ -67,6 +67,10 @@ Specify the target CPU and platform on which the generated code will ...@@ -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 be built. The target specification is in the standard autoconf format
as returned by config.sub. as returned by config.sub.
.TP .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 .BI \-d,\ --delay-lib= name
Set the delayed import mode for the specified library, which must be 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 one of the libraries imported with the \fB-l\fR option. Delayed mode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment