diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -691,9 +691,19 @@ # Propagate the LLD/LTO into the clang config option, so nothing else is needed. run_wrapper = [] -target_cflags = [getattr(config, 'target_cflags', None)] +target_cflags = [] extra_cflags = [] +# Handle target triple and sysroot. +if config.target_triple: + extra_cflags += ["--target=%s" % config.target_triple] +if config.sysroot: + extra_cflags += ["--sysroot=%s" % config.sysroot] +if config.osx_sysroot: + extra_cflags += ["-isysroot %s" % config.osx_sysroot] + +target_cflags.append(getattr(config, 'target_cflags', None)) + if config.use_lto and config.lto_supported: extra_cflags += config.lto_flags elif config.use_lto and (not config.lto_supported): diff --git a/compiler-rt/test/lit.common.configured.in b/compiler-rt/test/lit.common.configured.in --- a/compiler-rt/test/lit.common.configured.in +++ b/compiler-rt/test/lit.common.configured.in @@ -8,6 +8,8 @@ # Generic config options for all compiler-rt lit tests. set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@") set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@") +set_default("sysroot", "@CMAKE_SYSROOT@") +set_default("osx_sysroot", "@CMAKE_OSX_SYSROOT@") set_default("host_arch", "@HOST_ARCH@") set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@") set_default("host_os", "@HOST_OS@")