diff --git a/swift/toolchains/swift_toolchain.bzl b/swift/toolchains/swift_toolchain.bzl index f0d3458af..e8ca37a86 100644 --- a/swift/toolchains/swift_toolchain.bzl +++ b/swift/toolchains/swift_toolchain.bzl @@ -416,7 +416,7 @@ def _swift_toolchain_impl(ctx): os = ctx.attr.os, target_system_name = cc_toolchain.target_gnu_system_name, ) - target_triple = target_triples.normalize_for_swift( + target_triple = ctx.var.get("CC_TARGET_TRIPLE") or target_triples.normalize_for_swift( target_triples.parse(target_system_name), ) diff --git a/swift/toolchains/xcode_swift_toolchain.bzl b/swift/toolchains/xcode_swift_toolchain.bzl index aad7cf54b..706793047 100644 --- a/swift/toolchains/xcode_swift_toolchain.bzl +++ b/swift/toolchains/xcode_swift_toolchain.bzl @@ -627,7 +627,7 @@ def _xcode_swift_toolchain_impl(ctx): apple_toolchain = apple_common.apple_toolchain() cc_toolchain = find_cpp_toolchain(ctx) - target_triple = target_triples.normalize_for_swift( + target_triple = ctx.var.get("CC_TARGET_TRIPLE") or target_triples.normalize_for_swift( target_triples.parse(cc_toolchain.target_gnu_system_name), )