[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
Mon Mar 16 19:08:00 PDT 2020
MaskRay updated this revision to Diff 250673.
MaskRay retitled this revision from "[MC] Don't use SHT_X86_64_UNWIND for .eh_frame on non-Solaris OSes" to "[MC][X86] Allow SHT_PROGBITS for .eh_frame on x86-64".
MaskRay added a comment.
Fix test. Fix title.
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,12 @@
.pushsection .foo,"a", at nobits
.pushsection .foo,"a", at progbits
+
+
+# x86-64 psABI allows SHT_PROGBITS as an alternative section type.
+# Don't error for SHT_PROGBITS
+.section .eh_frame,"a", at progbits
+.section .eh_frame,"a", at unwind
+
+# 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,10 @@
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 still allows SHT_PROGBITS as an alternative type.
+ 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.250673.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200317/0126207b/attachment.bin>
More information about the llvm-commits
mailing list