Commit c14bdaf1 authored by Charles Davis's avatar Charles Davis Committed by Alexandre Julliard

winebuild: Use Clang to assemble if found.

parent 79808429
...@@ -288,8 +288,6 @@ char *find_tool( const char *name, const char * const *names ) ...@@ -288,8 +288,6 @@ char *find_tool( const char *name, const char * const *names )
unsigned int i, len; unsigned int i, len;
struct stat st; struct stat st;
if (target_alias) return strmake( "%s-%s", target_alias, name );
if (!dirs) if (!dirs)
{ {
char *path; char *path;
...@@ -322,6 +320,8 @@ char *find_tool( const char *name, const char * const *names ) ...@@ -322,6 +320,8 @@ char *find_tool( const char *name, const char * const *names )
while (*names) while (*names)
{ {
len = strlen(*names) + sizeof(EXEEXT) + 1; len = strlen(*names) + sizeof(EXEEXT) + 1;
if (target_alias)
len += strlen(target_alias) + 1;
file = xmalloc( maxlen + len ); file = xmalloc( maxlen + len );
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
...@@ -330,6 +330,12 @@ char *find_tool( const char *name, const char * const *names ) ...@@ -330,6 +330,12 @@ char *find_tool( const char *name, const char * const *names )
p = file + strlen(file); p = file + strlen(file);
if (p == file) *p++ = '.'; if (p == file) *p++ = '.';
if (p[-1] != '/') *p++ = '/'; if (p[-1] != '/') *p++ = '/';
if (target_alias)
{
strcpy( p, target_alias );
p += strlen(p);
*p++ = '-';
}
strcpy( p, *names ); strcpy( p, *names );
strcat( p, EXEEXT ); strcat( p, EXEEXT );
...@@ -338,21 +344,38 @@ char *find_tool( const char *name, const char * const *names ) ...@@ -338,21 +344,38 @@ char *find_tool( const char *name, const char * const *names )
free( file ); free( file );
names++; names++;
} }
return xstrdup( name ); return NULL;
} }
struct strarray *get_as_command(void) struct strarray *get_as_command(void)
{ {
static int as_is_clang = 0;
struct strarray *args = strarray_init(); struct strarray *args = strarray_init();
if (!as_command) if (!as_command)
{ {
as_command = find_tool( "clang", NULL );
if (as_command) as_is_clang = 1;
}
if (!as_command)
{
static const char * const commands[] = { "gas", "as", NULL }; static const char * const commands[] = { "gas", "as", NULL };
as_command = find_tool( "as", commands ); as_command = find_tool( "as", commands );
} }
if (!as_command)
fatal_error( "cannot find suitable assembler\n" );
strarray_add_one( args, as_command ); strarray_add_one( args, as_command );
if (force_pointer_size) 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)
{ {
switch (target_platform) switch (target_platform)
{ {
...@@ -386,6 +409,10 @@ struct strarray *get_ld_command(void) ...@@ -386,6 +409,10 @@ struct strarray *get_ld_command(void)
static const char * const commands[] = { "ld", "gld", NULL }; static const char * const commands[] = { "ld", "gld", NULL };
ld_command = find_tool( "ld", commands ); ld_command = find_tool( "ld", commands );
} }
if (!ld_command)
fatal_error( "cannot find suitable linker\n" );
strarray_add_one( args, ld_command ); strarray_add_one( args, ld_command );
if (force_pointer_size) if (force_pointer_size)
...@@ -421,6 +448,9 @@ const char *get_nm_command(void) ...@@ -421,6 +448,9 @@ const char *get_nm_command(void)
static const char * const commands[] = { "nm", "gnm", NULL }; static const char * const commands[] = { "nm", "gnm", NULL };
nm_command = find_tool( "nm", commands ); nm_command = find_tool( "nm", commands );
} }
if (!nm_command)
fatal_error( "cannot find suitable name lister\n" );
return nm_command; return nm_command;
} }
......
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