Index: llvm/trunk/lib/MC/ELFObjectWriter.cpp =================================================================== --- llvm/trunk/lib/MC/ELFObjectWriter.cpp +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp @@ -200,7 +200,7 @@ bool shouldRelocateWithSymbol(const MCAssembler &Asm, const MCSymbolRefExpr *RefA, - const MCSymbol *Sym, uint64_t C, + const MCSymbolELF *Sym, uint64_t C, unsigned Type) const; void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, @@ -511,9 +511,9 @@ // allows us to omit some local symbols from the symbol table. bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm, const MCSymbolRefExpr *RefA, - const MCSymbol *S, uint64_t C, + const MCSymbolELF *Sym, + uint64_t C, unsigned Type) const { - const auto *Sym = cast_or_null(S); // A PCRel relocation to an absolute value has no symbol (or section). We // represent that with a relocation to a null section. if (!RefA) @@ -711,9 +711,8 @@ if (!RelocateWithSymbol) { const MCSection *SecA = (SymA && !SymA->isUndefined()) ? &SymA->getSection() : nullptr; - auto *ELFSec = cast_or_null(SecA); const auto *SectionSymbol = - ELFSec ? cast(ELFSec->getBeginSymbol()) : nullptr; + SecA ? cast(SecA->getBeginSymbol()) : nullptr; if (SectionSymbol) SectionSymbol->setUsedInReloc(); ELFRelocationEntry Rec(FixupOffset, SectionSymbol, Type, Addend, SymA,