[lld] r316732 - De-template elf::getObjMsg. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 20:13:54 PDT 2017
Author: ruiu
Date: Thu Oct 26 20:13:54 2017
New Revision: 316732
URL: http://llvm.org/viewvc/llvm-project?rev=316732&view=rev
Log:
De-template elf::getObjMsg. NFC.
Modified:
lld/trunk/ELF/EhFrame.cpp
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/InputSection.h
lld/trunk/ELF/Relocations.cpp
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/EhFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/EhFrame.cpp?rev=316732&r1=316731&r2=316732&view=diff
==============================================================================
--- lld/trunk/ELF/EhFrame.cpp (original)
+++ lld/trunk/ELF/EhFrame.cpp Thu Oct 26 20:13:54 2017
@@ -45,7 +45,7 @@ public:
private:
template <class P> void failOn(const P *Loc, const Twine &Msg) {
fatal("corrupted .eh_frame: " + Msg + "\n>>> defined in " +
- IS->getObjMsg<ELFT>((const uint8_t *)Loc - IS->Data.data()));
+ IS->getObjMsg((const uint8_t *)Loc - IS->Data.data()));
}
uint8_t readByte();
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=316732&r1=316731&r2=316732&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Oct 26 20:13:54 2017
@@ -297,9 +297,8 @@ template <class ELFT> std::string InputS
// or
//
// path/to/foo.o:(function bar) in archive path/to/bar.a
-template <class ELFT> std::string InputSectionBase::getObjMsg(uint64_t Off) {
+std::string InputSectionBase::getObjMsg(uint64_t Off) {
// Synthetic sections don't have input files.
- ObjFile<ELFT> *File = getFile<ELFT>();
if (!File)
return ("(internal):(" + Name + "+0x" + utohexstr(Off) + ")").str();
std::string Filename = File->getName();
@@ -309,7 +308,7 @@ template <class ELFT> std::string InputS
Archive = (" in archive " + File->ArchiveName).str();
// Find a symbol that encloses a given location.
- for (SymbolBody *B : getFile<ELFT>()->getSymbols())
+ for (SymbolBody *B : File->getSymbols())
if (auto *D = dyn_cast<DefinedRegular>(B))
if (D->Section == this && D->Value <= Off && Off < D->Value + D->Size)
return Filename + ":(" + toString(*D) + ")" + Archive;
@@ -988,11 +987,6 @@ template std::string InputSectionBase::g
template std::string InputSectionBase::getSrcMsg<ELF64LE>(uint64_t);
template std::string InputSectionBase::getSrcMsg<ELF64BE>(uint64_t);
-template std::string InputSectionBase::getObjMsg<ELF32LE>(uint64_t);
-template std::string InputSectionBase::getObjMsg<ELF32BE>(uint64_t);
-template std::string InputSectionBase::getObjMsg<ELF64LE>(uint64_t);
-template std::string InputSectionBase::getObjMsg<ELF64BE>(uint64_t);
-
template void InputSection::writeTo<ELF32LE>(uint8_t *);
template void InputSection::writeTo<ELF32BE>(uint8_t *);
template void InputSection::writeTo<ELF64LE>(uint8_t *);
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=316732&r1=316731&r2=316732&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Thu Oct 26 20:13:54 2017
@@ -183,7 +183,7 @@ public:
// Returns a source location string. Used to construct an error message.
template <class ELFT> std::string getLocation(uint64_t Offset);
template <class ELFT> std::string getSrcMsg(uint64_t Offset);
- template <class ELFT> std::string getObjMsg(uint64_t Offset);
+ std::string getObjMsg(uint64_t Offset);
// Each section knows how to relocate itself. These functions apply
// relocations, assuming that Buf points to this section's copy in
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=316732&r1=316731&r2=316732&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Thu Oct 26 20:13:54 2017
@@ -77,7 +77,7 @@ static std::string getLocation(InputSect
std::string Src = S.getSrcMsg<ELFT>(Off);
if (!Src.empty())
Msg += Src + "\n>>> ";
- return Msg + S.getObjMsg<ELFT>(Off);
+ return Msg + S.getObjMsg(Off);
}
// This is a MIPS-specific rule.
@@ -733,7 +733,7 @@ static bool maybeReportUndefined(SymbolB
std::string Src = Sec.getSrcMsg<ELFT>(Offset);
if (!Src.empty())
Msg += Src + "\n>>> ";
- Msg += Sec.getObjMsg<ELFT>(Offset);
+ Msg += Sec.getObjMsg(Offset);
if ((Config->UnresolvedSymbols == UnresolvedPolicy::Warn && CanBeExternal) ||
Config->NoinhibitExec) {
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=316732&r1=316731&r2=316732&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Thu Oct 26 20:13:54 2017
@@ -463,9 +463,9 @@ static void reportDuplicate(SymbolBody *
// >>> baz.o in archive libbaz.a
auto *Sec1 = cast<InputSectionBase>(D->Section);
std::string Src1 = Sec1->getSrcMsg<ELFT>(D->Value);
- std::string Obj1 = Sec1->getObjMsg<ELFT>(D->Value);
+ std::string Obj1 = Sec1->getObjMsg(D->Value);
std::string Src2 = ErrSec->getSrcMsg<ELFT>(ErrOffset);
- std::string Obj2 = ErrSec->getObjMsg<ELFT>(ErrOffset);
+ std::string Obj2 = ErrSec->getObjMsg(ErrOffset);
std::string Msg = "duplicate symbol: " + toString(*Sym) + "\n>>> defined at ";
if (!Src1.empty())
More information about the llvm-commits
mailing list