[llvm] r299817 - MC: Remove unused virtual function MCObjectWriter::isWeak. NFC.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 13:42:07 PDT 2017
Thanks!
On 8 April 2017 at 19:35, Peter Collingbourne via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: pcc
> Date: Sat Apr 8 18:35:49 2017
> New Revision: 299817
>
> URL: http://llvm.org/viewvc/llvm-project?rev=299817&view=rev
> Log:
> MC: Remove unused virtual function MCObjectWriter::isWeak. NFC.
>
> Modified:
> llvm/trunk/include/llvm/MC/MCObjectWriter.h
> llvm/trunk/lib/MC/ELFObjectWriter.cpp
> llvm/trunk/lib/MC/MCObjectWriter.cpp
> llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
>
> Modified: llvm/trunk/include/llvm/MC/MCObjectWriter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectWriter.h?rev=299817&r1=299816&r2=299817&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCObjectWriter.h (original)
> +++ llvm/trunk/include/llvm/MC/MCObjectWriter.h Sat Apr 8 18:35:49 2017
> @@ -109,11 +109,6 @@ public:
> bool InSet,
> bool IsPCRel) const;
>
> - /// 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
> - /// past it.
> - virtual bool isWeak(const MCSymbol &Sym) const;
> -
> /// Write the object file.
> ///
> /// This routine is called by the assembler after layout and relaxation is
>
> Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=299817&r1=299816&r2=299817&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
> +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Sat Apr 8 18:35:49 2017
> @@ -248,8 +248,6 @@ public:
> const MCFragment &FB, bool InSet,
> bool IsPCRel) const override;
>
> - bool isWeak(const MCSymbol &Sym) const override;
> -
> void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
> void writeSection(const SectionIndexMapTy &SectionIndexMap,
> uint32_t GroupSymbolIndex, uint64_t Offset, uint64_t Size,
> @@ -1359,34 +1357,13 @@ bool ELFObjectWriter::isSymbolRefDiffere
> const auto &SymA = cast<MCSymbolELF>(SA);
> if (IsPCRel) {
> assert(!InSet);
> - if (::isWeak(SymA))
> + if (isWeak(SymA))
> return false;
> }
> return MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
> InSet, IsPCRel);
> }
>
> -bool ELFObjectWriter::isWeak(const MCSymbol &S) const {
> - const auto &Sym = cast<MCSymbolELF>(S);
> - if (::isWeak(Sym))
> - return true;
> -
> - // It is invalid to replace a reference to a global in a comdat
> - // with a reference to a local since out of comdat references
> - // to a local are forbidden.
> - // We could try to return false for more cases, like the reference
> - // being in the same comdat or Sym being an alias to another global,
> - // but it is not clear if it is worth the effort.
> - if (Sym.getBinding() != ELF::STB_GLOBAL)
> - return false;
> -
> - if (!Sym.isInSection())
> - return false;
> -
> - const auto &Sec = cast<MCSectionELF>(Sym.getSection());
> - return Sec.getGroup();
> -}
> -
> MCObjectWriter *llvm::createELFObjectWriter(MCELFObjectTargetWriter *MOTW,
> raw_pwrite_stream &OS,
> bool IsLittleEndian) {
>
> Modified: llvm/trunk/lib/MC/MCObjectWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectWriter.cpp?rev=299817&r1=299816&r2=299817&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCObjectWriter.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectWriter.cpp Sat Apr 8 18:35:49 2017
> @@ -51,5 +51,3 @@ bool MCObjectWriter::isSymbolRefDifferen
> // On ELF and COFF A - B is absolute if A and B are in the same section.
> return &SecA == &SecB;
> }
> -
> -bool MCObjectWriter::isWeak(const MCSymbol &) const { return false; }
>
> Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=299817&r1=299816&r2=299817&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
> +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Sat Apr 8 18:35:49 2017
> @@ -194,8 +194,6 @@ public:
> const MCFragment &FB, bool InSet,
> bool IsPCRel) const override;
>
> - bool isWeak(const MCSymbol &Sym) const override;
> -
> void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
> const MCFragment *Fragment, const MCFixup &Fixup,
> MCValue Target, bool &IsPCRel,
> @@ -709,23 +707,6 @@ bool WinCOFFObjectWriter::isSymbolRefDif
> InSet, IsPCRel);
> }
>
> -bool WinCOFFObjectWriter::isWeak(const MCSymbol &Sym) const {
> - if (!Sym.isExternal())
> - return false;
> -
> - if (!Sym.isInSection())
> - return false;
> -
> - const auto &Sec = cast<MCSectionCOFF>(Sym.getSection());
> - if (!Sec.getCOMDATSymbol())
> - return false;
> -
> - // It looks like for COFF it is invalid to replace a reference to a global
> - // in a comdat with a reference to a local.
> - // FIXME: Add a specification reference if available.
> - return true;
> -}
> -
> void WinCOFFObjectWriter::recordRelocation(
> MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment,
> const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list