-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[MCAsmStreamer] Do not crash on switching to sections of unknown types #92380
Conversation
@llvm/pr-subscribers-mc Author: Ivan Kosarev (kosarev) ChangesFull diff: https://github.com/llvm/llvm-project/pull/92380.diff 2 Files Affected:
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index b1efb839ba75f..6bbdef3dce32a 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -175,8 +175,7 @@ void MCSectionELF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
else if (Type == ELF::SHT_LLVM_LTO)
OS << "llvm_lto";
else
- report_fatal_error("unsupported type 0x" + Twine::utohexstr(Type) +
- " for section " + getName());
+ OS << "0x" << Twine::utohexstr(Type);
if (EntrySize) {
assert(Flags & ELF::SHF_MERGE);
diff --git a/llvm/test/MC/ELF/section-numeric-invalid-type.s b/llvm/test/MC/ELF/section-numeric-invalid-type.s
index fefc364d9917b..32ef8fc462a8f 100644
--- a/llvm/test/MC/ELF/section-numeric-invalid-type.s
+++ b/llvm/test/MC/ELF/section-numeric-invalid-type.s
@@ -1,7 +1,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux-gnu %s -o - \
// RUN: | llvm-readobj -S --symbols - | FileCheck --check-prefix=OBJ %s
-// RUN: not --crash llvm-mc -filetype=asm -triple=x86_64-pc-linux-gnu %s -o - 2>&1 \
+// RUN: llvm-mc -filetype=asm -triple=x86_64-pc-linux-gnu %s -o - \
// RUN: | FileCheck --check-prefix=ASM %s
.section .sec,"a",@0x7fffffff
@@ -11,4 +11,4 @@
// OBJ-NEXT: Type: Unknown (0x7FFFFFFF)
// OBJ: }
-// ASM: unsupported type 0x7fffffff for section .sec
+// ASM: .section .sec,"a",@0x7fffffff
|
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.
Most commits don't append a trailing .
to the title.
The description can be made to say that this fixes a crash for MCAsmStreamer. MCObjectStreamer already accepts unknown types.
@@ -1,7 +1,7 @@ | |||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux-gnu %s -o - \ | |||
// RUN: | llvm-readobj -S --symbols - | FileCheck --check-prefix=OBJ %s | |||
|
|||
// RUN: not --crash llvm-mc -filetype=asm -triple=x86_64-pc-linux-gnu %s -o - 2>&1 \ | |||
// RUN: llvm-mc -filetype=asm -triple=x86_64-pc-linux-gnu %s -o - \ |
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.
drop -o -
since it's the default
MCObjectStreamer already accepts unknown types.
25e04db
to
c4298d5
Compare
…9650cd441 Local branch amd-gfx c169650 Merged main:b27eb0ae8280675fc8fb249d39f1ccafa3ee2187 into amd-gfx:ea66a9b7b6c7 Remote branch main bbe40b9 [MCAsmStreamer] Do not crash on switching to sections of unknown types (llvm#92380)
MCObjectStreamer already accepts unknown types.