File tree Expand file tree Collapse file tree 5 files changed +31
-1
lines changed
lldb/packages/Python/lldbsuite/test Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def getCompiler(self):
26
26
27
27
def getTriple (self , arch ):
28
28
"""Returns the triple for the given architecture or None."""
29
- return None
29
+ return configuration . triple
30
30
31
31
def getExtraMakeArgs (self ):
32
32
"""
@@ -37,6 +37,9 @@ def getExtraMakeArgs(self):
37
37
38
38
def getArchCFlags (self , architecture ):
39
39
"""Returns the ARCH_CFLAGS for the make system."""
40
+ triple = self .getTriple (architecture )
41
+ if triple :
42
+ return ["ARCH_CFLAGS=-target {}" .format (triple )]
40
43
return []
41
44
42
45
def getMake (self , test_subdir , test_name ):
Original file line number Diff line number Diff line change 45
45
sdkroot = None
46
46
make_path = None
47
47
48
+ # Allow specifying a triple for cross compilation.
49
+ triple = None
50
+
48
51
# The overriden dwarf verison.
49
52
# Don't use this to test the current compiler's
50
53
# DWARF version, as this won't be set if the
141
144
# Typical values include Debug, Release, RelWithDebInfo and MinSizeRel
142
145
cmake_build_type = None
143
146
147
+
144
148
def shouldSkipBecauseOfCategories (test_categories ):
145
149
if use_categories :
146
150
if (
Original file line number Diff line number Diff line change @@ -321,8 +321,13 @@ def parseOptionsAndInitTestdirs():
321
321
logging .error ("No SDK found with the name %s; aborting..." , args .apple_sdk )
322
322
sys .exit (- 1 )
323
323
324
+ if args .triple :
325
+ configuration .triple = args .triple
326
+
324
327
if args .arch :
325
328
configuration .arch = args .arch
329
+ elif args .triple :
330
+ configuration .arch = args .triple .split ("-" )[0 ]
326
331
else :
327
332
configuration .arch = platform_machine
328
333
Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ def create_parser():
58
58
"""Specify the path to sysroot. This overrides apple_sdk sysroot."""
59
59
),
60
60
)
61
+ group .add_argument (
62
+ "--triple" ,
63
+ metavar = "triple" ,
64
+ dest = "triple" ,
65
+ help = textwrap .dedent (
66
+ """Specify the target triple. Used for cross compilation."""
67
+ ),
68
+ )
61
69
if sys .platform == "darwin" :
62
70
group .add_argument (
63
71
"--apple-sdk" ,
Original file line number Diff line number Diff line change @@ -148,6 +148,16 @@ else
148
148
endif
149
149
endif
150
150
151
+ #----------------------------------------------------------------------
152
+ # Use LLD when cross compiling on Darwin.
153
+ #----------------------------------------------------------------------
154
+ ifeq "$(HOST_OS)" "Darwin"
155
+ ifneq (,$(filter $(OS), Android FreeBSD Linux NetBSD Windows_NT))
156
+ LDFLAGS += -fuse-ld=lld
157
+ endif
158
+ endif
159
+
160
+
151
161
#----------------------------------------------------------------------
152
162
# ARCHFLAG is the flag used to tell the compiler which architecture
153
163
# to compile for. The default is the flag that clang accepts.
You can’t perform that action at this time.
0 commit comments