winebuild: Allow using clang for as command.

Since a9b5bb326a, Wine needs
get_as_command to work without cc_command available. While as is usually
a GCC dependency, Clang toolchains may not contain it.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-12-16 17:16:51 +01:00 committed by Alexandre Julliard
parent ea7eb95682
commit f4ddcc36e9
1 changed files with 26 additions and 9 deletions

View File

@ -250,7 +250,7 @@ struct strarray find_tool( const char *name, const char * const *names )
names++;
}
if (!file && strcmp( name, "as" )) /* llvm-as is not a gas replacement */
if (!file)
{
if (cc_command.count) file = find_clang_tool( cc_command, name );
if (!file && !(file = find_binary( "llvm", name )))
@ -289,11 +289,36 @@ struct strarray find_link_tool(void)
struct strarray get_as_command(void)
{
struct strarray args = empty_strarray;
const char *file;
unsigned int i;
int using_cc = 0;
if (cc_command.count)
{
strarray_addall( &args, cc_command );
using_cc = 1;
}
else if (as_command.count)
{
strarray_addall( &args, as_command );
}
else if ((file = find_binary( target_alias, "as" )) || (file = find_binary( target_alias, "gas ")))
{
strarray_add( &args, file );
}
else if ((file = find_binary( NULL, "clang" )))
{
strarray_add( &args, file );
if (target_alias)
{
strarray_add( &args, "-target" );
strarray_add( &args, target_alias );
}
using_cc = 1;
}
if (using_cc)
{
strarray_add( &args, "-xassembler" );
strarray_add( &args, "-c" );
if (force_pointer_size)
@ -306,14 +331,6 @@ struct strarray get_as_command(void)
return args;
}
if (!as_command.count)
{
static const char * const commands[] = { "gas", "as", NULL };
as_command = find_tool( "as", commands );
}
strarray_addall( &args, as_command );
if (force_pointer_size)
{
switch (target.platform)