[PATCH] D76151: [MC] Don't use SHT_X86_64_UNWIND for .eh_frame on non-Solaris OSes

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 16 10:52:50 PDT 2020


MaskRay updated this revision to Diff 250597.
MaskRay edited the summary of this revision.
MaskRay added a comment.

Repurpose


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,10 @@
 .pushsection .foo,"a", at nobits
 
 .pushsection .foo,"a", at progbits
+
+
+# SHT_X86_64_UNWIND x86-64 psABI
+# CHECK: {{.*}}.s:[[# @LINE+1]]:1: error: changed section type for .eh_frame, expected: 0x70000001
+.pushsection .eh_frame,"a", at progbits
+
+.pushsection .eh_frame,"a", at unwind
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 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.250597.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200316/85530d62/attachment.bin>


More information about the llvm-commits mailing list