[Lldb-commits] [PATCH] D68980: [LLDB] [test] Allow specifying the full arch for msvc/clang-cl in build.py

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 16 01:45:34 PDT 2019


mstorsjo updated this revision to Diff 225171.
mstorsjo retitled this revision from "[LLDB] [test] Pass --target=<arch>-windows-msvc to clang-cl" to "[LLDB] [test] Allow specifying the full arch for msvc/clang-cl in build.py".
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Extended the `--arch` option to build.py, to allow it to take a proper architecture name instead of just "32" and "64", when used with msvc or clang-cl.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68980/new/

https://reviews.llvm.org/D68980

Files:
  lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
  lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
  lldb/test/Shell/helper/build.py


Index: lldb/test/Shell/helper/build.py
===================================================================
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -4,6 +4,7 @@
 
 import argparse
 import os
+import re
 import signal
 import subprocess
 import sys
@@ -26,7 +27,6 @@
                     dest='arch',
                     required=True,
                     default='host',
-                    choices=['32', '64', 'host'],
                     help='Specify the architecture to target.')
 
 parser.add_argument('--compiler',
@@ -277,7 +277,14 @@
     def __init__(self, toolchain_type, args):
         Builder.__init__(self, toolchain_type, args, '.obj')
 
-        self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
+        if self.arch == '32' or re.match(r'i\d86', self.arch):
+            self.msvc_arch_str = 'x86'
+        elif self.arch == '64' or self.arch == 'host' or self.arch == 'x86_64':
+            self.msvc_arch_str = 'x64'
+        elif self.arch == 'aarch64' or self.arch == 'arm64':
+            self.msvc_arch_str = 'arm64'
+        elif re.match(r'^arm', self.arch):
+            self.msvc_arch_str = 'arm'
 
         if toolchain_type == 'msvc':
             # Make sure we're using the appropriate toolchain for the desired
@@ -553,7 +560,10 @@
 
         args.append(self.compiler)
         if self.toolchain_type == 'clang-cl':
-            args.append('-m' + self.arch)
+            if self.arch == '32' or self.arch == '64':
+                args.append('-m' + self.arch)
+            elif self.arch != 'host':
+                args.append('--target=%s-windows-msvc' % (self.arch))
 
         if self.opt == 'none':
             args.append('/Od')
Index: lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
===================================================================
--- lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
+++ lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
@@ -1,7 +1,7 @@
 // clang-format off
 // REQUIRES: lld
 
-// RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib -o %t.exe -- %s 
+// RUN: %build --compiler=clang-cl --arch=i386 --nodefaultlib -o %t.exe -- %s
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/function-types-calling-conv.lldbinit | FileCheck %s
 
Index: lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
===================================================================
--- lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
+++ lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
@@ -2,7 +2,7 @@
 // REQUIRES: lld
 
 // Test that we can show disassembly and source.
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
+// RUN: %build --compiler=clang-cl --arch=x86_64 --nodefaultlib -o %t.exe -- %s
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN:     %p/Inputs/disassembly.lldbinit | FileCheck %s
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68980.225171.patch
Type: text/x-patch
Size: 2965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191016/bd142aa7/attachment-0001.bin>


More information about the lldb-commits mailing list