forked from OSchip/llvm-project
[ELF2] Fixed crash when no library is specified for -l
llvm-svn: 250811
This commit is contained in:
parent
8f81e88184
commit
b7d79b5c27
|
@ -91,6 +91,8 @@ std::string lld::elf2::findFromSearchPaths(StringRef Path) {
|
|||
// Searches a given library from input search paths, which are filled
|
||||
// from -L command line switches. Returns a path to an existent library file.
|
||||
std::string lld::elf2::searchLibrary(StringRef Path) {
|
||||
if (Path.empty())
|
||||
error("No library specified for -l");
|
||||
std::vector<std::string> Names;
|
||||
if (Path[0] == ':') {
|
||||
Names.push_back(Path.drop_front());
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
// RUN: llvm-ar rcs %t.dir/libls.a %tst.o
|
||||
// REQUIRES: x86
|
||||
|
||||
// Should fail if no library specified
|
||||
// RUN: not ld.lld2 -l 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=NOLIBRARY %s
|
||||
// NOLIBRARY: No library specified for -l
|
||||
|
||||
// Should not link because of undefined symbol _bar
|
||||
// RUN: not ld.lld2 -o %t3 %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=UNDEFINED %s
|
||||
|
|
Loading…
Reference in New Issue