[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().

llvm-svn: 336813
This commit is contained in:
George Rimar 2018-07-11 15:11:13 +00:00
parent 876e99bf2c
commit cb17fdbe3c
2 changed files with 6 additions and 0 deletions

View File

@ -2946,6 +2946,10 @@ bool ARMExidxSentinelSection::empty() const {
return true; 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) ThunkSection::ThunkSection(OutputSection *OS, uint64_t Off)
: SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS,
Config->Wordsize, ".text.thunk") { Config->Wordsize, ".text.thunk") {

View File

@ -924,6 +924,8 @@ public:
void writeTo(uint8_t *Buf) override; void writeTo(uint8_t *Buf) override;
bool empty() const override; bool empty() const override;
static bool classof(const SectionBase *D);
// The last section referenced by a regular .ARM.exidx section. // The last section referenced by a regular .ARM.exidx section.
// It is found and filled in Writer<ELFT>::resolveShfLinkOrder(). // It is found and filled in Writer<ELFT>::resolveShfLinkOrder().
// The sentinel points at the end of that section. // The sentinel points at the end of that section.