[llvm] bbe40b9 - [MCAsmStreamer] Do not crash on switching to sections of unknown types (#92380)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 03:20:37 PDT 2024
Author: Ivan Kosarev
Date: 2024-05-17T11:20:33+01:00
New Revision: bbe40b9e0a24605e0526475e643312839772294f
URL: https://github.com/llvm/llvm-project/commit/bbe40b9e0a24605e0526475e643312839772294f
DIFF: https://github.com/llvm/llvm-project/commit/bbe40b9e0a24605e0526475e643312839772294f.diff
LOG: [MCAsmStreamer] Do not crash on switching to sections of unknown types (#92380)
MCObjectStreamer already accepts unknown types.
Added:
Modified:
llvm/lib/MC/MCSectionELF.cpp
llvm/test/MC/ELF/section-numeric-invalid-type.s
Removed:
################################################################################
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..b707b51c5ecce 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-mc -filetype=obj -triple=x86_64-pc-linux-gnu %s \
// 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 \
// RUN: | FileCheck --check-prefix=ASM %s
.section .sec,"a", at 0x7fffffff
@@ -11,4 +11,4 @@
// OBJ-NEXT: Type: Unknown (0x7FFFFFFF)
// OBJ: }
-// ASM: unsupported type 0x7fffffff for section .sec
+// ASM: .section .sec,"a", at 0x7fffffff
More information about the llvm-commits
mailing list