Skip to content

[MCAsmStreamer] Do not crash on switching to sections of unknown types #92380

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

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/lib/MC/MCSectionELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/MC/ELF/section-numeric-invalid-type.s
Original file line number Diff line number Diff line change
@@ -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",@0x7fffffff
Expand All @@ -11,4 +11,4 @@
// OBJ-NEXT: Type: Unknown (0x7FFFFFFF)
// OBJ: }

// ASM: unsupported type 0x7fffffff for section .sec
// ASM: .section .sec,"a",@0x7fffffff
Loading