summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-09-08 23:26:54 +0000
committerRui Ueyama <ruiu@google.com>2016-09-08 23:26:54 +0000
commit86c5fb8296dde8a927b9e1630e89037b4bbfd26e (patch)
treefa684015c676d54653d96ce8c09d58b4b63a8d0c
parentec6a774ed23d99be19466e2c65e2d28b3cf4ca7f (diff)
downloadbcm5719-llvm-86c5fb8296dde8a927b9e1630e89037b4bbfd26e.tar.gz
bcm5719-llvm-86c5fb8296dde8a927b9e1630e89037b4bbfd26e.zip
Fix bug in -nostdlib.
We still have to skip a token inside SEARCH_DIR() when -nostdlib is specified. Previuosly, we didn't skip it, so it caused a parse error. llvm-svn: 281001
-rw-r--r--lld/ELF/LinkerScript.cpp3
-rw-r--r--lld/test/ELF/libsearch.s4
2 files changed, 5 insertions, 2 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index eeb6dc278be..223218f4084 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -886,8 +886,9 @@ void ScriptParser::readPhdrs() {
void ScriptParser::readSearchDir() {
expect("(");
+ StringRef Tok = next();
if (!Config->Nostdlib)
- Config->SearchPaths.push_back(next());
+ Config->SearchPaths.push_back(Tok);
expect(")");
}
diff --git a/lld/test/ELF/libsearch.s b/lld/test/ELF/libsearch.s
index 98512cdfd63..309fa996b55 100644
--- a/lld/test/ELF/libsearch.s
+++ b/lld/test/ELF/libsearch.s
@@ -88,7 +88,9 @@
// -nostdlib
// RUN: echo 'SEARCH_DIR(' %t.dir ')' > %t.script
// RUN: ld.lld -o %t3 %t.o -script %t.script -lls
-// RUN: not ld.lld -o %t3 %t.o -script %t.script -lls -nostdlib
+// RUN: not ld.lld -o %t3 %t.o -script %t.script -lls -nostdlib \
+// RUN: 2>&1 | FileCheck --check-prefix=NOSTDLIB %s
+// NOSTDLIB: unable to find library -lls
.globl _start,_bar
_start:
OpenPOWER on IntegriCloud