-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[MC][ELF] Fix printing group signature symbols. #112543
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
Conversation
3bd56e3 to
c9d2e73
Compare
|
@llvm/pr-subscribers-mc Author: Ivan Kosarev (kosarev) ChangesThey may be not known. Change-Id: I66543240af2d10d77b4f7f23c06553356b3ec767 Full diff: https://github.com/llvm/llvm-project/pull/112543.diff 1 Files Affected:
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 25e62b70b5e2a0..3dc9a67e63939a 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -191,8 +191,10 @@ void MCSectionELF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
}
if (Flags & ELF::SHF_GROUP) {
- OS << ",";
- printName(OS, Group.getPointer()->getName());
+ if (const MCSymbolELF *Signature = Group.getPointer()) {
+ OS << ",";
+ printName(OS, Signature->getName());
+ }
if (isComdat())
OS << ",comdat";
}
|
|
@MaskRay If this needs a test, can you give some pointers as to what it might look like and where we would want it, please? Not quite my area. |
|
When is it unknown? We need a test. |
MaskRay
left a comment
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.
.
|
Caught downstream, yes. The comment for the There's also a guarding |
They may be not known. Change-Id: Ie69060a2f7d049a11afa7b5e7c7f132ccb0a592d
c9d2e73 to
7354caa
Compare
|
Added test. |
|
In the test you added I am still not convinced we should take the change. Perhaps we should disallow SHF_GROUP without a signature in switchSection. This isn't valid in ELF. |
Should the ELF loading code do the check then? |
The section creation code can have an assert |
Having the assert without the loading code erroring out signature-less group sections means we'll just crash on loading such ELFs. |
|
We should avoid this construct when a SHF_GROUP section without a signature symbol is constructed. Factory functions can have this precondition. |
They may be not known.