Skip to content

Commit b5cf6e5

Browse files
author
Mariusz Borsa
committed
Add --enable-asan option in swift-driver
This is to support building the swift-driver with -sanitize=address when the Swift build preset specifies enable-asan. Without this option and with enable-asan in picture the entire Swift build fails due to ASAN initialization failure in swift-driver. rdar://104661463
1 parent 679b324 commit b5cf6e5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Utilities/build-script-helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,9 @@ def build_using_cmake(args, toolchain_bin, build_dir, targets):
418418
base_swift_flags.append('-Onone')
419419
base_swift_flags.append('-DDEBUG')
420420

421+
if args.enable_asan:
422+
base_swift_flags.append('-sanitize=address')
423+
421424
# Ensure we are not sharing the module cache with concurrent builds in CI
422425
base_swift_flags.append('-module-cache-path "{}"'.format(os.path.join(build_dir, 'module-cache')))
423426

@@ -641,6 +644,7 @@ def add_common_args(parser):
641644
parser.add_argument('--no-local-deps', action='store_true', help='use normal remote dependencies when building')
642645
parser.add_argument('--verbose', '-v', action='store_true', help='enable verbose output')
643646
parser.add_argument('--local_compiler_build', action='store_true', help='driver is being built for use with a local compiler build')
647+
parser.add_argument('--enable-asan', action='store_true', help='driver is being built with ASAN support')
644648

645649
subparsers = parser.add_subparsers(title='subcommands', dest='action', metavar='action')
646650
clean_parser = subparsers.add_parser('clean', help='clean the package')

0 commit comments

Comments
 (0)