forked from OSchip/llvm-project
Move OffsetInArchive to BitcodeFile.
It is the only file type that needs it. llvm-svn: 298323
This commit is contained in:
parent
82a0c97b32
commit
b57e496dfa
|
@ -767,7 +767,8 @@ static uint8_t getBitcodeMachineKind(MemoryBufferRef MB) {
|
|||
}
|
||||
}
|
||||
|
||||
BitcodeFile::BitcodeFile(MemoryBufferRef MB) : InputFile(BitcodeKind, MB) {
|
||||
BitcodeFile::BitcodeFile(MemoryBufferRef MB, uint64_t OffsetInArchive)
|
||||
: InputFile(BitcodeKind, MB), OffsetInArchive(OffsetInArchive) {
|
||||
EKind = getBitcodeELFKind(MB);
|
||||
EMachine = getBitcodeMachineKind(MB);
|
||||
}
|
||||
|
@ -905,10 +906,9 @@ static bool isBitcode(MemoryBufferRef MB) {
|
|||
|
||||
InputFile *elf::createObjectFile(MemoryBufferRef MB, StringRef ArchiveName,
|
||||
uint64_t OffsetInArchive) {
|
||||
InputFile *F =
|
||||
isBitcode(MB) ? make<BitcodeFile>(MB) : createELFFile<ObjectFile>(MB);
|
||||
InputFile *F = isBitcode(MB) ? make<BitcodeFile>(MB, OffsetInArchive)
|
||||
: createELFFile<ObjectFile>(MB);
|
||||
F->ArchiveName = ArchiveName;
|
||||
F->OffsetInArchive = OffsetInArchive;
|
||||
return F;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,12 +79,6 @@ public:
|
|||
// string for creating error messages.
|
||||
StringRef ArchiveName;
|
||||
|
||||
// If this file is in an archive, the member contains the offset of
|
||||
// the file in the archive. Otherwise, it's just zero. We store this
|
||||
// field so that we can pass it to lib/LTO in order to disambiguate
|
||||
// between objects.
|
||||
uint64_t OffsetInArchive;
|
||||
|
||||
// If this is an architecture-specific file, the following members
|
||||
// have ELF type (i.e. ELF{32,64}{LE,BE}) and target machine type.
|
||||
ELFKind EKind = ELFNoneKind;
|
||||
|
@ -255,13 +249,19 @@ private:
|
|||
|
||||
class BitcodeFile : public InputFile {
|
||||
public:
|
||||
explicit BitcodeFile(MemoryBufferRef M);
|
||||
BitcodeFile(MemoryBufferRef M, uint64_t OffsetInArchive);
|
||||
static bool classof(const InputFile *F) { return F->kind() == BitcodeKind; }
|
||||
template <class ELFT>
|
||||
void parse(llvm::DenseSet<llvm::CachedHashStringRef> &ComdatGroups);
|
||||
ArrayRef<Symbol *> getSymbols() { return Symbols; }
|
||||
std::unique_ptr<llvm::lto::InputFile> Obj;
|
||||
|
||||
// If this file is in an archive, the member contains the offset of
|
||||
// the file in the archive. Otherwise, it's just zero. We store this
|
||||
// field so that we can pass it to lib/LTO in order to disambiguate
|
||||
// between objects.
|
||||
uint64_t OffsetInArchive;
|
||||
|
||||
private:
|
||||
std::vector<Symbol *> Symbols;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue