forked from OSchip/llvm-project
Remember OffsetInArchive in LazyObjectFile.
LazyObjectFile might turn out to be a BitcodeFile, so we need OffsetInArchive. llvm-svn: 302242
This commit is contained in:
parent
0b1413a881
commit
0f6cc65fe9
|
@ -187,7 +187,7 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
|
|||
// we'll handle it as if it had a symbol table.
|
||||
if (!File->hasSymbolTable()) {
|
||||
for (const auto &P : getArchiveMembers(MBRef))
|
||||
Files.push_back(make<LazyObjectFile>(P.first, Path));
|
||||
Files.push_back(make<LazyObjectFile>(P.first, Path, P.second));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
|
|||
return;
|
||||
default:
|
||||
if (InLib)
|
||||
Files.push_back(make<LazyObjectFile>(MBRef, ""));
|
||||
Files.push_back(make<LazyObjectFile>(MBRef, "", 0));
|
||||
else
|
||||
Files.push_back(createObjectFile(MBRef));
|
||||
}
|
||||
|
|
|
@ -981,7 +981,7 @@ InputFile *LazyObjectFile::fetch() {
|
|||
MemoryBufferRef MBRef = getBuffer();
|
||||
if (MBRef.getBuffer().empty())
|
||||
return nullptr;
|
||||
return createObjectFile(MBRef, ArchiveName);
|
||||
return createObjectFile(MBRef, ArchiveName, OffsetInArchive);
|
||||
}
|
||||
|
||||
template <class ELFT> void LazyObjectFile::parse() {
|
||||
|
|
|
@ -219,8 +219,9 @@ private:
|
|||
// archive file semantics.
|
||||
class LazyObjectFile : public InputFile {
|
||||
public:
|
||||
explicit LazyObjectFile(MemoryBufferRef M, StringRef ArchiveName)
|
||||
: InputFile(LazyObjectKind, M) {
|
||||
explicit LazyObjectFile(MemoryBufferRef M, StringRef ArchiveName,
|
||||
uint64_t OffsetInArchive)
|
||||
: InputFile(LazyObjectKind, M), OffsetInArchive(OffsetInArchive) {
|
||||
this->ArchiveName = ArchiveName;
|
||||
}
|
||||
|
||||
|
@ -238,6 +239,7 @@ private:
|
|||
std::vector<StringRef> getBitcodeSymbols();
|
||||
|
||||
bool Seen = false;
|
||||
uint64_t OffsetInArchive;
|
||||
};
|
||||
|
||||
// An ArchiveFile object represents a .a file.
|
||||
|
|
|
@ -2,9 +2,15 @@
|
|||
; RUN: mkdir -p %t1 %t2
|
||||
; RUN: opt -module-summary %p/Inputs/thin1.ll -o %t1/t.coll.o
|
||||
; RUN: opt -module-summary %p/Inputs/thin2.ll -o %t2/t.coll.o
|
||||
|
||||
; RUN: rm -f %t.a
|
||||
; RUN: llvm-ar rcs %t.a %t1/t.coll.o %t2/t.coll.o
|
||||
; RUN: ld.lld %t.o %t.a -o %t
|
||||
; RUN: llvm-nm %t | FileCheck %s
|
||||
|
||||
; Check without a archive symbol table
|
||||
; RUN: rm -f %t.a
|
||||
; RUN: llvm-ar rcS %t.a %t1/t.coll.o %t2/t.coll.o
|
||||
; RUN: ld.lld %t.o %t.a -o %t
|
||||
; RUN: llvm-nm %t | FileCheck %s
|
||||
|
||||
|
|
Loading…
Reference in New Issue