From c856fd2a4ced689e1cb4510d1bbfbe6bcc6237f2 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 13 Nov 2023 19:16:36 +0000 Subject: [PATCH] Add workaround for 5.8 host swift-driver bug A 5.8 swift-driver does not pass along the `--sanitize` flag to the Clang linker (rdar://107733898). Add this workaround to allow building an ASAN swift-driver with a 5.8 toolchain. --- Utilities/build-script-helper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/build-script-helper.py b/Utilities/build-script-helper.py index add35e400..1970af284 100755 --- a/Utilities/build-script-helper.py +++ b/Utilities/build-script-helper.py @@ -420,6 +420,10 @@ def build_using_cmake(args, toolchain_bin, build_dir, targets): if args.enable_asan: base_swift_flags.append('-sanitize=address') + # This is currently needed to work around a swift-driver + # bug when building with a 5.8 host toolchain. + base_swift_flags.append('-Xclang-linker') + base_swift_flags.append('-fsanitize=address') # Ensure we are not sharing the module cache with concurrent builds in CI base_swift_flags.append('-module-cache-path "{}"'.format(os.path.join(build_dir, 'module-cache')))