-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Unify COFF and ELF data structures and procedures #32478
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
Unify COFF and ELF data structures and procedures #32478
Conversation
@swift-ci please test Windows platform |
946b9f0
to
0fc7f99
Compare
0fc7f99
to
0288e3a
Compare
@swift-ci please test Windows platform |
1 similar comment
@swift-ci please test Windows platform |
0288e3a
to
ee2abcb
Compare
@swift-ci please test Windows platform |
@swift-ci please test windows platform |
@swift-ci please test Linux platform |
4bf2415
to
8908394
Compare
20b4ac0
to
8279a83
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
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.
I think this is in great shape!
edit: I have some questions, but I don't intend them to be blocking.
Build failed |
8279a83
to
29ffee6
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
Build failed |
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.
Some comments about style. Question. Would it make more sense to do this refactor in two PRs. The first that refactors one of ELF/COFF to the new world (which ever is easer) and then a second PR that changes the 2nd to use the new world? That will make it easier to review and smaller.
29ffee6
to
9982163
Compare
@gottesmm I opened a PR which only moves the ELF Switching subjects: this PR failed the mac tests during the weekend, but I believe the reason is unrelated to the PR itself. I found two other PRs which failed in the exact same test here and here. The second PR passed with the |
b02aaef
to
e273628
Compare
@gottesmm Does swift have some guidelines on how to split up a PR? This one (second in the stack) is based on master, so it looks as complicated as the combined changes. Should follow up PRs in a stack be based off the developer topic branch to create a patch stack, or should commits just be split up within a single PR? |
__swift_size_t length; | ||
} MetadataSectionRange; | ||
|
||
struct MetadataSections { |
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.
Can you please add doxygen comments to each type declaration (and any non-obvious members)?
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.
I added a doxygen comment for each declaration, although I'm not sure if they're very useful right now.
@compnerd since you wrote these data structures, do you think I should add something more to the documentation?
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.
Minor nit: the doxygen comments in this repository uses ///
for the comment leader.
I would describe them as:
/// Specifies the address range corresponding to a section.
and
/// Identifies the address space ranges for the Swift metadata required by the Swift runtime.
The two fields that are are "non-obvious" are next
and prev
:
/// `next` and `prev` are used by the runtime to construct a
/// circularly doubly linked list to quickly iterate over the metadata
/// from each image loaded into the address space. These are invasive
/// to enable the runtime registration, which occurs at image load time, to
/// be allocation-free as it is invoked from an image constructor function
/// context where the system may not yet be ready to perform allocations.
/// Additionally, avoiding the allocation enables a fast load operation, which
/// directly impacts application load time.
503d591
to
9e83aa6
Compare
@vedantk @adrian-prantl @compnerd I've rebased on top of the merge of the previous PR. Could one of you start the tests please? :) |
@swift-ci test |
Build failed |
Build failed |
@vedantk @adrian-prantl @compnerd The build failed in both macOS and Linux with a "Wrong sha" message. I'm unsure what this means, would that be the version of one of the other sub-projects? |
I think it (or someone) relaunched it afterwards. Let me know if you need me to restart it again. |
@swift-ci please test Windows platform |
9e83aa6
to
5cee6f3
Compare
@vedantk @adrian-prantl @compnerd All tests have passed, but I had to update the comment describing Do we re-run the tests? |
@swift-ci test |
Build failed |
Build failed |
@swift-ci smoke test |
It seems like the linux test failed to build SwiftPM:
I think this is unrelated to the tests themselves. |
@swift-ci please smoke test Linux platform |
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.
This definitely improves things. Minor cleanups for the future include adding a missing newline on the new header and possibly collapsing the const cast into the reinterpret cast. However, neither one of those cleanups is valuable enough to hold off on this change.
|
This PR unifies the
MetadataSections
data structure present both inImageInspectionELF.h
andImageInspectionCOFF.h
, as well as prepare it to be accessible from Swift. It also unifies the procedures which were identical under ELF and COFF in a newImageInspectionCommon
file.@vedantk @compnerd