[llvm] d0c4277 - [MC][ARM] Don't create multiple .ARM.exidx associated to one .text
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 25 18:19:03 PST 2020
Author: Fangrui Song
Date: 2020-02-25T18:18:13-08:00
New Revision: d0c4277d388628154b647a45cbc6914a1ea5a822
URL: https://github.com/llvm/llvm-project/commit/d0c4277d388628154b647a45cbc6914a1ea5a822
DIFF: https://github.com/llvm/llvm-project/commit/d0c4277d388628154b647a45cbc6914a1ea5a822.diff
LOG: [MC][ARM] Don't create multiple .ARM.exidx associated to one .text
Fixed an issue exposed by 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 .
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D75095
Added:
Modified:
llvm/lib/MC/MCContext.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 6cda18adb881..524ef44d1863 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -405,6 +405,7 @@ MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
StringRef Group = "";
if (GroupSym)
Group = GroupSym->getName();
+ assert(!(LinkedToSym && LinkedToSym->getName().empty()));
// Do the lookup, if we have a hit, return it.
auto IterBool = ELFUniquingMap.insert(std::make_pair(
ELFSectionKey{Section.str(), Group,
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index b13188ad9a5e..ef9804ab63a5 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -1201,7 +1201,7 @@ inline void ARMELFStreamer::SwitchToEHSection(StringRef Prefix,
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");
More information about the llvm-commits
mailing list