[PATCH] D76151: [MC][X86] Allow SHT_PROGBITS for .eh_frame on x86-64
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 11:08:55 PDT 2020
MaskRay updated this revision to Diff 258089.
MaskRay edited the summary of this revision.
MaskRay added a comment.
Mention GNU as but drop mention of x86-64 psABI change (which hasn't happened yet and may not happen)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76151/new/
https://reviews.llvm.org/D76151
Files:
llvm/lib/MC/MCParser/ELFAsmParser.cpp
llvm/test/MC/ELF/section-type-changed.s
Index: llvm/test/MC/ELF/section-type-changed.s
===================================================================
--- llvm/test/MC/ELF/section-type-changed.s
+++ llvm/test/MC/ELF/section-type-changed.s
@@ -9,3 +9,11 @@
.pushsection .foo,"a", at nobits
.pushsection .foo,"a", at progbits
+
+## GNU as emits SHT_PROGBITS .eh_frame for .cfi_* directives. Don't error.
+.section .eh_frame,"a", at progbits
+.section .eh_frame,"a", at unwind
+.pushsection .eh_frame,"a", at progbits
+
+# CHECK: {{.*}}.s:[[# @LINE+1]]:1: error: changed section type for .eh_frame, expected: 0x70000001
+.section .eh_frame,"a", at nobits
Index: llvm/lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -637,7 +637,11 @@
MCSectionELF *Section = getContext().getELFSection(
SectionName, Type, Flags, Size, GroupName, UniqueID, LinkedToSym);
getStreamer().SwitchSection(Section, Subsection);
- if (Section->getType() != Type)
+ // x86-64 psABI names SHT_X86_64_UNWIND as the canonical type for .eh_frame,
+ // but GNU as emits SHT_PROGBITS .eh_frame for .cfi_* directives. Don't error
+ // for SHT_PROGBITS .eh_frame
+ if (Section->getType() != Type &&
+ !(SectionName == ".eh_frame" && Type == ELF::SHT_PROGBITS))
Error(loc, "changed section type for " + SectionName + ", expected: 0x" +
utohexstr(Section->getType()));
if (Section->getFlags() != Flags)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76151.258089.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200416/2561af89/attachment-0001.bin>
More information about the llvm-commits
mailing list