Skip to content

Commit ce9feb5

Browse files
authored
Merge pull request #72554 from edymtt/edymtt/add-flag-to-pass-arguments-to-dsymutil-6.0
2 parents 8004d4a + 0e7eb75 commit ce9feb5

File tree

7 files changed

+45
-4
lines changed

7 files changed

+45
-4
lines changed

utils/build-script-impl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ KNOWN_SETTINGS=(
7575
use-gold-linker "" "Enable using the gold linker"
7676
workspace "${HOME}/src" "source directory containing llvm, clang, swift"
7777
dsymutil-jobs "1" "number of parallel invocations of dsymutil"
78+
extra-dsymutil-args "" "additional arguments to pass to dsymutil"
7879

7980
## Build Tools
8081
host-cc "" "the path to CC, the 'clang' compiler for the host platform. **This argument is required**"
@@ -3238,7 +3239,7 @@ for host in "${ALL_HOSTS[@]}"; do
32383239
printJSONStartTimestamp dsymutil
32393240
(cd "${host_symroot}" &&
32403241
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -not -name "*.a" -not -name "*.py" -print | \
3241-
xargs -t -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path})
3242+
xargs -t -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path} ${EXTRA_DSYMUTIL_ARGS[@]})
32423243
printJSONEndTimestamp dsymutil
32433244

32443245
# Strip executables, shared libraries and static libraries in

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,12 @@ def create_argument_parser():
556556
help='the maximum number of parallel dsymutil jobs to use when '
557557
'extracting symbols. Tweak with caution, since dsymutil '
558558
'is memory intensive.')
559+
option('--extra-dsymutil-args', append,
560+
type=argparse.ShellSplitType(),
561+
help='Pass through extra options to dsymutil when extracting '
562+
'symbols, in the form of comma separated options '
563+
'like "--verbose,--verify-dwarf=none". Can '
564+
'be called multiple times to add multiple such options.')
559565

560566
option('--disable-guaranteed-normal-arguments', store_true,
561567
help='Disable guaranteed normal arguments')

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
'sccache': False,
163163
'dry_run': False,
164164
'dsymutil_jobs': defaults.DSYMUTIL_JOBS,
165+
'extra_dsymutil_args': [],
165166
'enable_asan': False,
166167
'enable_experimental_differentiable_programming': True,
167168
'enable_experimental_concurrency': True,
@@ -788,6 +789,7 @@ class BuildScriptImplOption(_BaseOption):
788789
IntOption('-j', dest='build_jobs'),
789790
IntOption('--lit-jobs', dest='lit_jobs'),
790791
IntOption('--dsymutil-jobs', dest='dsymutil_jobs'),
792+
AppendOption('--extra-dsymutil-args', dest='extra_dsymutil_args'),
791793

792794
AppendOption('--cross-compile-hosts'),
793795
SetTrueOption('--infer-cross-compile-hosts-on-darwin'),

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ def convert_to_impl_arguments(self):
514514
' '.join(args.darwin_symroot_path_filters)
515515
]
516516

517+
if args.extra_dsymutil_args:
518+
impl_args += [
519+
"--extra-dsymutil-args=%s" % ' '.join(
520+
shlex.quote(opt) for opt in args.extra_dsymutil_args)
521+
]
522+
517523
# Compute the set of host-specific variables, which we pass through to
518524
# the build script via environment variables.
519525
host_specific_variables = self.compute_host_specific_variables()

utils/swift_build_support/tests/test_cmake.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ def default_args(self):
6868
build_ninja=False)
6969

7070
def which_ninja(self, args):
71-
toolchain = host_toolchain()
72-
if toolchain.ninja is not None:
73-
return '/path/to/installed/ninja'
7471
# Maybe we'll build a ninja, maybe we wont.
7572
# Fake it anyway for the tests.
7673
return '/path/to/built/ninja'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# REQUIRES: standalone_build,OS=macosx
2+
3+
# RUN: %empty-directory(%t)
4+
# RUN: mkdir -p %t
5+
# RUN: mkdir -p %t/destdir
6+
# RUN: mkdir -p %t/symroot/macosx-%target-cpu
7+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --extra-dsymutil-args="--verify-dwarf=none --verbose" --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
8+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --extra-dsymutil-args=--verify-dwarf=none,--verbose --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
9+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --extra-dsymutil-args="--verify-dwarf=none" --extra-dsymutil-args=--verbose --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
10+
11+
# CHECK: --- Extracting symbols ---
12+
# CHECK: { "command": "dsymutil", "start": "
13+
# CHECK: xargs -t -n 1 -P 1 {{.*}}dsymutil --verify-dwarf=none --verbose
14+
# CHECK: { "command": "dsymutil", "end": "
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# REQUIRES: standalone_build,OS=macosx
2+
3+
# RUN: %empty-directory(%t)
4+
# RUN: mkdir -p %t
5+
# RUN: mkdir -p %t/destdir
6+
# RUN: mkdir -p %t/symroot/macosx-%target-cpu
7+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --extra-dsymutil-args="" --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
8+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --extra-dsymutil-args= --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
9+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --extra-dsymutil-args="" --extra-dsymutil-args="" --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
10+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --enable-extract-symbol-dry-run-test=1 --host-target=macosx-%target-cpu --darwin-install-extract-symbols --cmake %cmake --install-symroot=%t/symroot --install-destdir=%t/destdir --toolchain-prefix= 2>&1 | %FileCheck %s
11+
12+
# CHECK: --- Extracting symbols ---
13+
# CHECK: { "command": "dsymutil", "start": "
14+
# CHECK: xargs -t -n 1 -P 1 {{.*}}dsymutil{{$}}
15+
# CHECK: { "command": "dsymutil", "end": "

0 commit comments

Comments
 (0)