mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-01 13:20:25 +00:00
Warn on empty archive files.
Differential Revision: https://reviews.llvm.org/D25044 llvm-svn: 282633
This commit is contained in:
parent
7ae1a67ed9
commit
cb85d7f840
@ -427,8 +427,17 @@ template <class ELFT> void ArchiveFile::parse() {
|
||||
File = check(Archive::create(MB), "failed to parse archive");
|
||||
|
||||
// Read the symbol table to construct Lazy objects.
|
||||
for (const Archive::Symbol &Sym : File->symbols())
|
||||
bool IsEmpty = true;
|
||||
for (const Archive::Symbol &Sym : File->symbols()) {
|
||||
Symtab<ELFT>::X->addLazyArchive(this, Sym);
|
||||
IsEmpty = false;
|
||||
}
|
||||
|
||||
if (IsEmpty)
|
||||
warning(getName() + " has no symbol. Chances are you are doing "
|
||||
"an LTO build and forgot to use an ar command that can create "
|
||||
"a symbol table for LLVM bitcode files. If so, use llvm-ar or "
|
||||
"GNU ar + plugin.");
|
||||
}
|
||||
|
||||
// Returns a buffer pointing to a member file containing a given symbol.
|
||||
|
@ -1,3 +1,5 @@
|
||||
// RUN: llvm-ar rc %t.a
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
||||
// RUN: ld.lld -shared %t.o %t.a -o t
|
||||
// RUN: ld.lld -shared %t.o %t.a -o t 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: has no symbol.
|
||||
|
Loading…
Reference in New Issue
Block a user