forked from OSchip/llvm-project
Move a function defintion to make it static.
llvm-svn: 290215
This commit is contained in:
parent
3f08914e7e
commit
6e3595d6c5
|
@ -29,6 +29,7 @@
|
|||
#include "InputFiles.h"
|
||||
#include "Memory.h"
|
||||
#include "OutputSections.h"
|
||||
#include "SymbolTable.h"
|
||||
#include "Symbols.h"
|
||||
#include "SyntheticSections.h"
|
||||
#include "Thunks.h"
|
||||
|
@ -55,6 +56,34 @@ std::string toString(uint32_t Type) {
|
|||
return getELFRelocationTypeName(Config->EMachine, Type);
|
||||
}
|
||||
|
||||
template <class ELFT> static std::string getErrorLoc(uint8_t *Loc) {
|
||||
for (InputSectionData *D : Symtab<ELFT>::X->Sections) {
|
||||
auto *IS = dyn_cast_or_null<InputSection<ELFT>>(D);
|
||||
if (!IS || !IS->OutSec)
|
||||
continue;
|
||||
|
||||
uint8_t *ISLoc = cast<OutputSection<ELFT>>(IS->OutSec)->Loc + IS->OutSecOff;
|
||||
if (ISLoc <= Loc && Loc < ISLoc + IS->getSize())
|
||||
return IS->getLocation(Loc - ISLoc) + ": ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static std::string getErrorLocation(uint8_t *Loc) {
|
||||
switch (Config->EKind) {
|
||||
case ELF32LEKind:
|
||||
return getErrorLoc<ELF32LE>(Loc);
|
||||
case ELF32BEKind:
|
||||
return getErrorLoc<ELF32BE>(Loc);
|
||||
case ELF64LEKind:
|
||||
return getErrorLoc<ELF64LE>(Loc);
|
||||
case ELF64BEKind:
|
||||
return getErrorLoc<ELF64BE>(Loc);
|
||||
default:
|
||||
llvm_unreachable("unknown ELF type");
|
||||
}
|
||||
}
|
||||
|
||||
template <unsigned N>
|
||||
static void checkInt(uint8_t *Loc, int64_t V, uint32_t Type) {
|
||||
if (!isInt<N>(V))
|
||||
|
|
|
@ -1697,34 +1697,6 @@ template <class ELFT> void Writer<ELFT>::writeBuildId() {
|
|||
In<ELFT>::BuildId->writeBuildId({Start, End});
|
||||
}
|
||||
|
||||
template <class ELFT> static std::string getErrorLoc(uint8_t *Loc) {
|
||||
for (InputSectionData *D : Symtab<ELFT>::X->Sections) {
|
||||
auto *IS = dyn_cast_or_null<InputSection<ELFT>>(D);
|
||||
if (!IS || !IS->OutSec)
|
||||
continue;
|
||||
|
||||
uint8_t *ISLoc = cast<OutputSection<ELFT>>(IS->OutSec)->Loc + IS->OutSecOff;
|
||||
if (ISLoc <= Loc && ISLoc + IS->getSize() > Loc)
|
||||
return IS->getLocation(Loc - ISLoc) + ": ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string elf::getErrorLocation(uint8_t *Loc) {
|
||||
switch (Config->EKind) {
|
||||
case ELF32LEKind:
|
||||
return getErrorLoc<ELF32LE>(Loc);
|
||||
case ELF32BEKind:
|
||||
return getErrorLoc<ELF32BE>(Loc);
|
||||
case ELF64LEKind:
|
||||
return getErrorLoc<ELF64LE>(Loc);
|
||||
case ELF64BEKind:
|
||||
return getErrorLoc<ELF64BE>(Loc);
|
||||
default:
|
||||
llvm_unreachable("unknown ELF type");
|
||||
}
|
||||
}
|
||||
|
||||
template void elf::writeResult<ELF32LE>();
|
||||
template void elf::writeResult<ELF32BE>();
|
||||
template void elf::writeResult<ELF64LE>();
|
||||
|
|
|
@ -60,7 +60,6 @@ uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
|
|||
llvm::StringRef FileName);
|
||||
|
||||
bool isMipsN32Abi(const InputFile *F);
|
||||
std::string getErrorLocation(uint8_t *Loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue