; RUN: llc -filetype=obj %s -o %t.o
; RUN: llc -filetype=obj %S/Inputs/archive1.ll -o %t.a1.o
; RUN: llc -filetype=obj %S/Inputs/archive2.ll -o %t.a2.o
-; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.a3.o
-; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o
+; RUN: llc -filetype=obj %S/Inputs/archive3.ll -o %t.a3.o
+; RUN: llc -filetype=obj %S/Inputs/hello.ll -o %t.hello.o
+; RUN: llvm-ar rcs %t.a %t.a1.o %t.a2.o %t.a3.o %t.hello.o
; RUN: rm -f %t.imports
; RUN: not wasm-ld %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-UNDEFINED %s
; TODO(ncw): Update LLD so that the symbol table is written out for
; non-relocatable output (with an option to strip it)
-; CHECK: 00000003 T _start
+; CHECK: 00000004 T _start
+; CHECK-NEXT: 00000002 T archive2_symbol
; CHECK-NEXT: 00000001 T bar
-; CHECK-NEXT: 00000002 T foo
+; CHECK-NEXT: 00000003 T foo
; CHECK-NEXT: U missing_func
; Verify that symbols from unused objects don't appear in the symbol table
; Specifying the same archive twice is allowed.
; RUN: wasm-ld %t.a %t.a %t.o -o %t.wasm
+
+; Verfiy errors include library name
+; RUN: not wasm-ld -u archive2_symbol -u archive3_symbol %t.a %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=CHECK-DUP %s
+; CHECK-DUP: error: duplicate symbol: bar
+; CHECK-DUP: >>> defined in {{.*}}.a({{.*}}.a2.o)
+; CHECK-DUP: >>> defined in {{.*}}.a({{.*}}.a3.o)
return;
}
- Obj->ParentName = ParentName;
+ Obj->ArchiveName = getName();
Symtab->addFile(Obj);
}
void BitcodeFile::parse() {
Obj = check(lto::InputFile::create(MemoryBufferRef(
- MB.getBuffer(), Saver.save(ParentName + MB.getBufferIdentifier()))));
+ MB.getBuffer(), Saver.save(ArchiveName + MB.getBufferIdentifier()))));
Triple T(Obj->getTargetTriple());
if (T.getArch() != Triple::wasm32) {
error(toString(MB.getBufferIdentifier()) + ": machine type must be wasm32");
if (!File)
return "<internal>";
- if (File->ParentName.empty())
+ if (File->ArchiveName.empty())
return File->getName();
- return (File->ParentName + "(" + File->getName() + ")").str();
+ return (File->ArchiveName + "(" + File->getName() + ")").str();
}