[lld] r336813 - [ELF] - Add classof() member for ARMExidxSentinelSection.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 11 08:11:13 PDT 2018
Author: grimar
Date: Wed Jul 11 08:11:13 2018
New Revision: 336813
URL: http://llvm.org/viewvc/llvm-project?rev=336813&view=rev
Log:
[ELF] - Add classof() member for ARMExidxSentinelSection.
Or code uses constructions like isa<ARMExidxSentinelSection>:
https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L1428
https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L2944
That is confusing, because without ARMExidxSentinelSection::classof()
these lines are equal to isa<SyntheticSection> and the code does not really do
the same what it expected to. I found no good way to break it though, but it is not nice.
Patch adds ARMExidxSentinelSection::classof().
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/SyntheticSections.h
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=336813&r1=336812&r2=336813&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Jul 11 08:11:13 2018
@@ -2946,6 +2946,10 @@ bool ARMExidxSentinelSection::empty() co
return true;
}
+bool ARMExidxSentinelSection::classof(const SectionBase *D) {
+ return D->kind() == InputSectionBase::Synthetic && D->Type == SHT_ARM_EXIDX;
+}
+
ThunkSection::ThunkSection(OutputSection *OS, uint64_t Off)
: SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS,
Config->Wordsize, ".text.thunk") {
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=336813&r1=336812&r2=336813&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Wed Jul 11 08:11:13 2018
@@ -924,6 +924,8 @@ public:
void writeTo(uint8_t *Buf) override;
bool empty() const override;
+ static bool classof(const SectionBase *D);
+
// The last section referenced by a regular .ARM.exidx section.
// It is found and filled in Writer<ELFT>::resolveShfLinkOrder().
// The sentinel points at the end of that section.
More information about the llvm-commits
mailing list