[lld] r281001 - Fix bug in -nostdlib.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 16:26:54 PDT 2016


Author: ruiu
Date: Thu Sep  8 18:26:54 2016
New Revision: 281001

URL: http://llvm.org/viewvc/llvm-project?rev=281001&view=rev
Log:
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.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/test/ELF/libsearch.s

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=281001&r1=281000&r2=281001&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Sep  8 18:26:54 2016
@@ -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(")");
 }
 

Modified: lld/trunk/test/ELF/libsearch.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/libsearch.s?rev=281001&r1=281000&r2=281001&view=diff
==============================================================================
--- lld/trunk/test/ELF/libsearch.s (original)
+++ lld/trunk/test/ELF/libsearch.s Thu Sep  8 18:26:54 2016
@@ -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:




More information about the llvm-commits mailing list