It is needed for creating an unique identifier for ThinLTO.
This fixes pr32931.
llvm-svn: 302235
// we'll handle it as if it had a symbol table.
if (!File->hasSymbolTable()) {
for (MemoryBufferRef MB : getArchiveMembers(MBRef))
- Files.push_back(make<LazyObjectFile>(MB));
+ Files.push_back(make<LazyObjectFile>(MB, MBRef.getBufferIdentifier()));
return;
}
return;
default:
if (InLib)
- Files.push_back(make<LazyObjectFile>(MBRef));
+ Files.push_back(make<LazyObjectFile>(MBRef, ""));
else
Files.push_back(createObjectFile(MBRef));
}
MemoryBufferRef MBRef = getBuffer();
if (MBRef.getBuffer().empty())
return nullptr;
- return createObjectFile(MBRef);
+ return createObjectFile(MBRef, ArchiveName);
}
template <class ELFT> void LazyObjectFile::parse() {
// archive file semantics.
class LazyObjectFile : public InputFile {
public:
- explicit LazyObjectFile(MemoryBufferRef M) : InputFile(LazyObjectKind, M) {}
+ explicit LazyObjectFile(MemoryBufferRef M, StringRef ArchiveName)
+ : InputFile(LazyObjectKind, M) {
+ this->ArchiveName = ArchiveName;
+ }
static bool classof(const InputFile *F) {
return F->kind() == LazyObjectKind;
--- /dev/null
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f2() {
+ ret void
+}
--- /dev/null
+; REQUIRES: x86
+; Cretae two archive with the same member name
+; RUN: rm -f %t1.a %t2.a
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-ar rcS %t1.a %t.o
+; RUN: opt -module-summary %p/Inputs/duplicated-name.ll -o %t.o
+; RUN: llvm-ar rcS %t2.a %t.o
+; RUN: ld.lld -m elf_x86_64 -shared -o %t.so -uf1 -uf2 %t1.a %t2.a
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f1() {
+ ret void
+}