Jacek Caban : winebuild: Allow using clang for as command.

Alexandre Julliard julliard at winehq.org
Thu Dec 16 16:39:21 CST 2021


Module: wine
Branch: master
Commit: f4ddcc36e97d391e841f82a07d4c06bd7c0dc701
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f4ddcc36e97d391e841f82a07d4c06bd7c0dc701

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Dec 16 17:16:51 2021 +0100

winebuild: Allow using clang for as command.

Since a9b5bb326a1514e2c4185633ab34b22c9bbc9863, 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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/winebuild/utils.c | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index a4393850823..42c5dca8516 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -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)




More information about the wine-cvs mailing list