-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add swift5_tests
to MetadataSections
.
#71509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add swift5_tests
to MetadataSections
.
#71509
Conversation
This PR adds a `swift5_tests` property to `MetadataSections` and populates it in the static constructors used on Linux and Windows. This section will be used by swift-testing to store test metadata for discovery at runtime (see swiftlang/swift-testing#210.) This change is necessary because on Linux and Windows, section boundaries are not discoverable at runtime and so must be noted on a per-image basis at compile time. (This is also why `MetadataSections` and the static constructors are present in the first place.) There are no compiler changes needed here. The compiler does not need special knowledge of the tests section emitted by swift-testing. The compiler does not itself need to emit anything into this section. This change does not affect platforms that use the Mach-O binary format (i.e. Darwin) because on those platforms, there is API to find sections and segments at runtime.
@swift-ci please smoke test |
That "ready for review" button is too easy to hit in the mobile app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition of this is fine. Where is the content emitted? The Windows case is particularly interesting as that requires specific section naming (the content itself must be emitted into the B
group so that the boundaries are properly ordered).
I believe it's going in the "C" section along with all the other emitted Swift section symbols. Mind helping me make sense of the macros in the SwiftRT-COFF source? |
Worth noting the plan for the ABI for this section is to emit data only, no executable code, so I think it should be fine to do the same as what other sections do? |
Re-reading the Windows section documentation here: I think we're fine? |
The section should be fine ( |
As of right now, the content of the section is not emitted by any component. swift-testing will (hopefully/eventually) start emitting data in a future PR. So I think all is well. |
This PR adds a
swift5_tests
property toMetadataSections
and populates it in the static constructors used on Linux and Windows. This section will be used by swift-testing to store test metadata for discovery at runtime (see swiftlang/swift-testing#210.)This change is necessary because on Linux and Windows, section boundaries are not discoverable at runtime and so must be noted on a per-image basis at compile time. (This is also why
MetadataSections
and the static constructors are present in the first place.)There are no compiler changes needed here. The compiler does not need special knowledge of the tests section emitted by swift-testing. The compiler does not itself need to emit anything into this section.
This change does not affect platforms that use the Mach-O binary format (i.e. Darwin) because on those platforms, there is API to find sections and segments at runtime.