Repository navigation
Workaround dyld warning about SwiftSyntax classes - #4901
Merged
Merged
Conversation
Closed
2 tasks done
Generated by 🚫 Danger |
keith
force-pushed
the
ks/workaround-dyld-warning-about-swiftsyntax-classes
branch
from
April 17, 2023 23:04
ab32ccd to
5de0031
Compare
jpsim
reviewed
Apr 17, 2023
This uses a recent but unannounced (also read as private) feature of dyld where it ignores duplicate Objective-C classes when they're in a special format in the binary. https://github.com/apple-oss-distributions/dyld/blob/c8a445f88f9fc1713db34674e79b00e30723e79d/dyld/PrebuiltLoader.cpp#L1660-L1662 I think this is generally safe because hopefully people aren't actually using the SwiftSyntax classes through the Objective-C runtime, but if they are we'd still probably prefer to silence the noise and accept the UB. Fixes #4782
keith
force-pushed
the
ks/workaround-dyld-warning-about-swiftsyntax-classes
branch
from
April 17, 2023 23:31
5de0031 to
fe4e25e
Compare
jpsim
approved these changes
Apr 17, 2023
jpsim
left a comment
Collaborator
There was a problem hiding this comment.
I dont love this solution but I don’t have any better ideas. Thanks!
Contributor
Author
|
I think the other option is to link against Xcode's version, but that obviously has the same downside as the previous internal dylib |
Collaborator
|
Yeah and I’d rather have this workaround if it means we control the version of SwiftSyntax we ship with. |
Collaborator
|
Doesn't seem to apply to tests: $ bazel test --test_output=streamed //Tests:GeneratedTests
WARNING: Streamed test output requested. All tests will be run locally, without sharding, one at a time
INFO: Analyzed target //Tests:GeneratedTests (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
Test Suite 'All tests' started at 2023-04-18 13:21:47.833
Test Suite 'GeneratedTests.xctest' started at 2023-04-18 13:21:47.834
Test Suite 'AccessibilityLabelForImageRuleGeneratedTests' started at 2023-04-18 13:21:47.834
Test Case '-[GeneratedTests.AccessibilityLabelForImageRuleGeneratedTests testWithDefaultConfiguration]' started.
objc[25929]: Class _TtC11SwiftSyntax16BumpPtrAllocator is implemented in both /private/var/tmp/_bazel_jsimard/7034bb326caf3934edced22f6f4dd368/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/Tests/GeneratedTests.xctest/Contents/MacOS/GeneratedTests (0x1079759c0) and /Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftSyntax.dylib (0x10a100a10). One of the two will be used. Which one is undefined.
objc[25929]: Class _TtC11SwiftSyntax35IncrementalParseReusedNodeCollector is implemented in both /private/var/tmp/_bazel_jsimard/7034bb326caf3934edced22f6f4dd368/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/Tests/GeneratedTests.xctest/Contents/MacOS/GeneratedTests (0x107975b78) and /Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftSyntax.dylib (0x10a100bc0). One of the two will be used. Which one is undefined.
objc[25929]: Class _TtC11SwiftSyntax26IncrementalParseTransition is implemented in both /private/var/tmp/_bazel_jsimard/7034bb326caf3934edced22f6f4dd368/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/Tests/GeneratedTests.xctest/Contents/MacOS/GeneratedTests (0x107975c10) and /Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftSyntax.dylib (0x10a100c58). One of the two will be used. Which one is undefined.
... |
Contributor
Author
|
Unfortunately it looks like the handling is such that only the main binary is consulted for this: My assumption is that in this case the main binary is |
jpsim
added a commit
that referenced
this pull request
Jun 19, 2023
Similar to #4901 but updated with a new warning from Xcode 15 beta 1. Unfortunately this doesn't appear to work, even with this change the warning is still logged. It might have something to do with how long the symbol name is.
jpsim
added a commit
that referenced
this pull request
Jun 22, 2023
Similar to #4901 but updated with a new warning from Xcode 15 beta 1. Increase dupclass max name length from 64 to 128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This uses a recent but unannounced (also read as private) feature of
dyld where it ignores duplicate Objective-C classes when they're in a
special format in the binary. https://github.com/apple-oss-distributions/dyld/blob/c8a445f88f9fc1713db34674e79b00e30723e79d/dyld/PrebuiltLoader.cpp#L1660-L1662
I think this is generally safe because hopefully people aren't actually
using the SwiftSyntax classes through the Objective-C runtime, but if
they are we'd still probably prefer to silence the noise and accept the
UB.
Fixes #4782