mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 02:24:29 +00:00
MC: Use MCSymbol in MCObjectWriter::isWeak(), NFC
Continue to prefer `MCSymbol` when we need both. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237798 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -101,7 +101,7 @@ public:
|
|||||||
/// \brief True if this symbol (which is a variable) is weak. This is not
|
/// \brief True if this symbol (which is a variable) is weak. This is not
|
||||||
/// just STB_WEAK, but more generally whether or not we can evaluate
|
/// just STB_WEAK, but more generally whether or not we can evaluate
|
||||||
/// past it.
|
/// past it.
|
||||||
virtual bool isWeak(const MCSymbolData &SD) const;
|
virtual bool isWeak(const MCSymbol &Sym) const;
|
||||||
|
|
||||||
/// \brief Write the object file.
|
/// \brief Write the object file.
|
||||||
///
|
///
|
||||||
|
@ -250,7 +250,7 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||||||
bool InSet,
|
bool InSet,
|
||||||
bool IsPCRel) const override;
|
bool IsPCRel) const override;
|
||||||
|
|
||||||
bool isWeak(const MCSymbolData &SD) const override;
|
bool isWeak(const MCSymbol &Sym) const override;
|
||||||
|
|
||||||
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
|
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
|
||||||
void writeSection(MCAssembler &Asm,
|
void writeSection(MCAssembler &Asm,
|
||||||
@ -1478,7 +1478,8 @@ bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
|||||||
InSet, IsPCRel);
|
InSet, IsPCRel);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ELFObjectWriter::isWeak(const MCSymbolData &SD) const {
|
bool ELFObjectWriter::isWeak(const MCSymbol &Sym) const {
|
||||||
|
const MCSymbolData &SD = Sym.getData();
|
||||||
if (::isWeak(SD))
|
if (::isWeak(SD))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -1491,7 +1492,6 @@ bool ELFObjectWriter::isWeak(const MCSymbolData &SD) const {
|
|||||||
if (MCELF::GetBinding(SD) != ELF::STB_GLOBAL)
|
if (MCELF::GetBinding(SD) != ELF::STB_GLOBAL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const MCSymbol &Sym = SD.getSymbol();
|
|
||||||
if (!Sym.isInSection())
|
if (!Sym.isInSection())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -608,8 +608,7 @@ static bool canExpand(const MCSymbol &Sym, const MCAssembler *Asm, bool InSet) {
|
|||||||
return true;
|
return true;
|
||||||
if (!Asm)
|
if (!Asm)
|
||||||
return false;
|
return false;
|
||||||
const MCSymbolData &SD = Asm->getSymbolData(Sym);
|
return !Asm->getWriter().isWeak(Sym);
|
||||||
return !Asm->getWriter().isWeak(SD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||||
|
@ -48,4 +48,4 @@ bool MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
|||||||
return &SecA == &SecB;
|
return &SecA == &SecB;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCObjectWriter::isWeak(const MCSymbolData &SD) const { return false; }
|
bool MCObjectWriter::isWeak(const MCSymbol &) const { return false; }
|
||||||
|
@ -175,7 +175,7 @@ public:
|
|||||||
const MCFragment &FB, bool InSet,
|
const MCFragment &FB, bool InSet,
|
||||||
bool IsPCRel) const override;
|
bool IsPCRel) const override;
|
||||||
|
|
||||||
bool isWeak(const MCSymbolData &SD) const override;
|
bool isWeak(const MCSymbol &Sym) const override;
|
||||||
|
|
||||||
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
|
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||||
const MCFragment *Fragment, const MCFixup &Fixup,
|
const MCFragment *Fragment, const MCFixup &Fixup,
|
||||||
@ -661,11 +661,11 @@ bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
|||||||
InSet, IsPCRel);
|
InSet, IsPCRel);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinCOFFObjectWriter::isWeak(const MCSymbolData &SD) const {
|
bool WinCOFFObjectWriter::isWeak(const MCSymbol &Sym) const {
|
||||||
|
const MCSymbolData &SD = Sym.getData();
|
||||||
if (!SD.isExternal())
|
if (!SD.isExternal())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const MCSymbol &Sym = SD.getSymbol();
|
|
||||||
if (!Sym.isInSection())
|
if (!Sym.isInSection())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user