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):
2626
2727 def getTriple (self , arch ):
2828 """Returns the triple for the given architecture or None."""
29- return None
29+ return configuration . triple
3030
3131 def getExtraMakeArgs (self ):
3232 """
@@ -37,6 +37,9 @@ def getExtraMakeArgs(self):
3737
3838 def getArchCFlags (self , architecture ):
3939 """Returns the ARCH_CFLAGS for the make system."""
40+ triple = self .getTriple (architecture )
41+ if triple :
42+ return ["ARCH_CFLAGS=-target {}" .format (triple )]
4043 return []
4144
4245 def getMake (self , test_subdir , test_name ):
Original file line number Diff line number Diff line change 4545sdkroot = None
4646make_path = None
4747
48+ # Allow specifying a triple for cross compilation.
49+ triple = None
50+
4851# The overriden dwarf verison.
4952# Don't use this to test the current compiler's
5053# DWARF version, as this won't be set if the
141144# Typical values include Debug, Release, RelWithDebInfo and MinSizeRel
142145cmake_build_type = None
143146
147+
144148def shouldSkipBecauseOfCategories (test_categories ):
145149 if use_categories :
146150 if (
Original file line number Diff line number Diff line change @@ -321,8 +321,13 @@ def parseOptionsAndInitTestdirs():
321321 logging .error ("No SDK found with the name %s; aborting..." , args .apple_sdk )
322322 sys .exit (- 1 )
323323
324+ if args .triple :
325+ configuration .triple = args .triple
326+
324327 if args .arch :
325328 configuration .arch = args .arch
329+ elif args .triple :
330+ configuration .arch = args .triple .split ("-" )[0 ]
326331 else :
327332 configuration .arch = platform_machine
328333
Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ def create_parser():
5858 """Specify the path to sysroot. This overrides apple_sdk sysroot."""
5959 ),
6060 )
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+ )
6169 if sys .platform == "darwin" :
6270 group .add_argument (
6371 "--apple-sdk" ,
Original file line number Diff line number Diff line change @@ -148,6 +148,16 @@ else
148148 endif
149149endif
150150
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+
151161#----------------------------------------------------------------------
152162# ARCHFLAG is the flag used to tell the compiler which architecture
153163# to compile for. The default is the flag that clang accepts.
You can’t perform that action at this time.
0 commit comments