-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add .note.swift_reflection_metadata #26479
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 .note.swift_reflection_metadata #26479
Conversation
c948998
to
5c8debe
Compare
@swift-ci test |
Build failed |
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.
Thanks a lot for working on this one! The general idea looks fine [I also talked with Joe offline and he seems onboard].
Looks like there's a build failure though.
13:25:20
/home/buildnode/jenkins/workspace/swift-PR-Linux/branch-master/swift/stdlib/public/runtime/SwiftRT-ELF.cpp:82:32: error: 'S' causes a section type conflict with 'MagicString'
13:25:20 const swift::MetadataSections *S = §ions;
13:25:20 ^
13:25:20 /home/buildnode/jenkins/workspace/swift-PR-Linux/branch-master/swift/stdlib/public/runtime/SwiftRT-ELF.cpp:76:12: note: declared here
13:25:20 const char MagicString[] = SWIFT_REFLECTION_METADATA_ELF_NOTE_MAGIC_STRING;
13:25:20 ^
5c8debe
to
01efda3
Compare
Fixed the build failure |
SWIFT_SECTION_RANGE(swift5_replac2), | ||
SWIFT_SECTION_RANGE(swift5_builtin), | ||
SWIFT_SECTION_RANGE(swift5_capture), | ||
}; |
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.
Does this not create a constructor? There is now a C++ constructor which runs separately than the actual constructor?
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.
Yeah. Maybe it gets optimized away by LLVM GlobalOpt, but we should double-check. What I had meant in the previous PR was that we could generate the symbol and its definition in a global asm
block, since the section ranges can be represented as constant expressions in assembly language, but not C.
__attribute__((__used__)) | ||
__attribute__((__section__(".note.swift_reflection_metadata"))) | ||
__attribute__((__aligned__(1))) | ||
const swift::MetadataSections *S = §ions; |
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 don't think that this works. The compiler is completely within its right to re-order the entries here. So we can end up with an invalid section here.
01efda3
to
c311bc2
Compare
Addressed comments |
c311bc2
to
623584e
Compare
Fixed typo |
@swift-ci test |
Build failed |
Build failed |
khm, sorry about the disturbance, it seems to me @swift-ci has tested some old commit instead of the latest one, maybe smb can kick off testing again |
@swift-ci please test |
Build failed |
623584e
to
1bb9d46
Compare
@swift-ci please test |
Build failed |
Build failed |
This is a peculiar failure
and definitely unrelated to the PR. Trying again. |
@swift-ci test linux platform |
__attribute__((__section__(".note.swift_reflection_metadata"))) | ||
__attribute__((__aligned__(1))) | ||
struct { | ||
const char MagicString[sizeof(SWIFT_REFLECTION_METADATA_ELF_NOTE_MAGIC_STRING)]; |
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 that doing sizeof(SWIFT_REFLECTION_METADATA_ELF_NOTE_MAGIC_STRING)/sizeof(*SWIFT_REFLECTION_METADATA_ELF_NOTE_MAGIC_STRING)
is better.
I'm fine with these changes assuming that @jckarter is also happy with it. |
Seems reasonable to me. |
1bb9d46
to
9a322f3
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test Linux platform |
Build failed |
@swift-ci please test |
Build failed |
9a322f3
to
791ca54
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test macOS platform |
Introduce .note.swift_reflection_metadata.