[PATCH] D75095: [MC][ARM] Don't create multiple .ARM.exidx associated to one .text

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 18:06:59 PST 2020


MaskRay created this revision.
MaskRay added a reviewer: efriedma.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls.
Herald added a project: LLVM.
MaskRay added a comment.

This can only be tested by `clang -c a.s` => `a.o`, which (I think) is generally not recommended...


Fixed an issue exposed by D74006 <https://reviews.llvm.org/D74006>.

In clang cc1as, MCContext::UseNamesOnTempLabels is true.
When parsing a .fnstart directive, FnStart gets redefined to a temporary symbol of a different name (.Ltmp0, .Ltmp1, ...).
MCContext::getELFSection() called by SwitchToEHSection() will create a different .ARM.exidx each time.

llvm-mc uses `Ctx.setUseNamesOnTempLabels(false);` and FnStart is unnamed.
MCContext::getELFSection() called by SwitchToEHSection() will reuse the same .ARM.exidx .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75095

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp


Index: llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -1201,7 +1201,7 @@
     Flags |= ELF::SHF_GROUP;
   MCSectionELF *EHSection = getContext().getELFSection(
       EHSecName, Type, Flags, 0, Group, FnSection.getUniqueID(),
-      static_cast<const MCSymbolELF *>(&Fn));
+      static_cast<const MCSymbolELF *>(FnSection.getBeginSymbol()));
 
   assert(EHSection && "Failed to get the required EH section");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75095.246353.patch
Type: text/x-patch
Size: 600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200225/e6975c06/attachment.bin>


More information about the llvm-commits mailing list