forked from OSchip/llvm-project
parent
f10cc02591
commit
9f37543cf8
|
@ -72,6 +72,11 @@ public:
|
||||||
|
|
||||||
Kind kind() const { return FileKind; }
|
Kind kind() const { return FileKind; }
|
||||||
|
|
||||||
|
bool isElf() const {
|
||||||
|
Kind K = kind();
|
||||||
|
return K == ObjKind || K == SharedKind;
|
||||||
|
}
|
||||||
|
|
||||||
StringRef getName() const { return MB.getBufferIdentifier(); }
|
StringRef getName() const { return MB.getBufferIdentifier(); }
|
||||||
MemoryBufferRef MB;
|
MemoryBufferRef MB;
|
||||||
|
|
||||||
|
@ -121,10 +126,7 @@ public:
|
||||||
typedef typename ELFT::SymRange Elf_Sym_Range;
|
typedef typename ELFT::SymRange Elf_Sym_Range;
|
||||||
|
|
||||||
ELFFileBase(Kind K, MemoryBufferRef M);
|
ELFFileBase(Kind K, MemoryBufferRef M);
|
||||||
static bool classof(const InputFile *F) {
|
static bool classof(const InputFile *F) { return F->isElf(); }
|
||||||
Kind K = F->kind();
|
|
||||||
return K == ObjKind || K == SharedKind;
|
|
||||||
}
|
|
||||||
|
|
||||||
llvm::object::ELFFile<ELFT> getObj() const {
|
llvm::object::ELFFile<ELFT> getObj() const {
|
||||||
return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
|
return check(llvm::object::ELFFile<ELFT>::create(MB.getBuffer()));
|
||||||
|
|
|
@ -44,8 +44,8 @@ static InputFile *getFirstElf() {
|
||||||
// All input object files must be for the same architecture
|
// All input object files must be for the same architecture
|
||||||
// (e.g. it does not make sense to link x86 object files with
|
// (e.g. it does not make sense to link x86 object files with
|
||||||
// MIPS object files.) This function checks for that error.
|
// MIPS object files.) This function checks for that error.
|
||||||
template <class ELFT> static bool isCompatible(InputFile *F) {
|
static bool isCompatible(InputFile *F) {
|
||||||
if (!isa<ELFFileBase<ELFT>>(F) && !isa<BitcodeFile>(F))
|
if (!F->isElf() && !isa<BitcodeFile>(F))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (F->EKind == Config->EKind && F->EMachine == Config->EMachine) {
|
if (F->EKind == Config->EKind && F->EMachine == Config->EMachine) {
|
||||||
|
@ -64,7 +64,7 @@ template <class ELFT> static bool isCompatible(InputFile *F) {
|
||||||
|
|
||||||
// Add symbols in File to the symbol table.
|
// Add symbols in File to the symbol table.
|
||||||
template <class ELFT> void SymbolTable::addFile(InputFile *File) {
|
template <class ELFT> void SymbolTable::addFile(InputFile *File) {
|
||||||
if (!isCompatible<ELFT>(File))
|
if (!isCompatible(File))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Binary file
|
// Binary file
|
||||||
|
|
Loading…
Reference in New Issue