-
Notifications
You must be signed in to change notification settings - Fork 36
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
[WIP] Enable support for the @_section
experimental attribute.
#210
Draft
grynspan
wants to merge
1
commit into
main
Choose a base branch
from
jgrynspan/adopt-section-attribute
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+309
−114
Conversation
This file contains 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
@swift-ci please test |
grynspan
added a commit
to apple/swift
that referenced
this pull request
Feb 9, 2024
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 apple/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.
grynspan
force-pushed
the
jgrynspan/adopt-section-attribute
branch
from
February 9, 2024 19:49
c4f2d40
to
b586d1b
Compare
@swift-ci please test |
grynspan
added
enhancement
New feature or request
tools integration
Integration of swift-testing into tools/IDEs
labels
Feb 15, 2024
@compnerd says the Windows section needs the suffix |
compnerd
reviewed
Feb 19, 2024
compnerd
reviewed
Feb 19, 2024
grynspan
force-pushed
the
jgrynspan/adopt-section-attribute
branch
from
February 20, 2024 20:19
b586d1b
to
5498dfa
Compare
@swift-ci please test |
Linux failure is expected right now; the new |
Looks like Windows has a compile-time complaint about the constness of C function pointers. |
@swift-ci please test |
grynspan
force-pushed
the
jgrynspan/adopt-section-attribute
branch
from
February 27, 2024 19:37
5498dfa
to
98807fe
Compare
@swift-ci please test |
grynspan
force-pushed
the
jgrynspan/adopt-section-attribute
branch
from
March 7, 2024 16:32
98807fe
to
554a343
Compare
This PR enables support for `@_used` and `@_section` to allow embedding test data directly into its own section in a binary. This means we don't have to look up synthesized test types at runtime. Limitations: 1. Test clients must enable support for the experimental `"SymbolLinkageMarkers"` feature. 1. The `@_section` attribute currently doesn't support application to constants of function type, thinking they are non-constant. 1. We will need to make a change to the Swift runtime on Linux/Windows to add the new section to `MetadataSections` (or alternatively, the experimental feature needs to provide a different way to discover sections at runtime.) 1. We will need to make a change to the Swift compiler on Linux/Windows to ensure that the aforementioned section is always emitted since section discovery on those platforms is based on static linkage of the section boundary symbols (so if they're not present, a linker error will occur.) :warning: Do not merge: this is a proof-of-concept and work-in-progress.
grynspan
force-pushed
the
jgrynspan/adopt-section-attribute
branch
from
March 7, 2024 16:45
554a343
to
5cd3809
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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 PR enables support for
@_used
and@_section
to allow embedding test data directly into its own section in a binary. This means we don't have to look up synthesized test types at runtime.Limitations:
"SymbolLinkageMarkers"
feature.@_section
attribute currently doesn't support application to constants of function type, thinking they are non-constant.MetadataSections
(or alternatively, the experimental feature needs to provide a different way to discover sections at runtime.) See Addswift5_tests
toMetadataSections
. swift#71509.Checklist: