[lld] r249707 - [ELF2] Implement linker script SEARCH_DIR() directive.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 10:51:41 PDT 2015
Author: davide
Date: Thu Oct 8 12:51:41 2015
New Revision: 249707
URL: http://llvm.org/viewvc/llvm-project?rev=249707&view=rev
Log:
[ELF2] Implement linker script SEARCH_DIR() directive.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/elf2/linkerscript.s
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=249707&r1=249706&r2=249707&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Oct 8 12:51:41 2015
@@ -41,6 +41,7 @@ private:
void readGroup();
void readOutput();
void readOutputFormat();
+ void readSearchDir();
std::vector<StringRef> Tokens;
size_t Pos = 0;
@@ -58,6 +59,8 @@ void LinkerScript::run() {
readOutput();
} else if (Tok == "OUTPUT_FORMAT") {
readOutputFormat();
+ } else if (Tok == "SEARCH_DIR") {
+ readSearchDir();
} else {
error("unknown directive: " + Tok);
}
@@ -173,6 +176,12 @@ void LinkerScript::readOutputFormat() {
expect(")");
}
+void LinkerScript::readSearchDir() {
+ expect("(");
+ Config->InputSearchPaths.push_back(next());
+ expect(")");
+}
+
// Entry point. The other functions or classes are private to this file.
void lld::elf2::readLinkerScript(MemoryBufferRef MB) {
LinkerScript(MB.getBuffer()).run();
Modified: lld/trunk/test/elf2/linkerscript.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/linkerscript.s?rev=249707&r1=249706&r2=249707&view=diff
==============================================================================
--- lld/trunk/test/elf2/linkerscript.s (original)
+++ lld/trunk/test/elf2/linkerscript.s Thu Oct 8 12:51:41 2015
@@ -43,6 +43,10 @@
# RUN: ld.lld2 %t.script %t
# RUN: llvm-readobj %t.out > /dev/null
+# RUN: echo "SEARCH_DIR(/lib/foo/blah)" > %t.script
+# RUN: ld.lld2 %t.script %t
+# RUN: llvm-readobj %t.out > /dev/null
+
# RUN: echo "FOO(BAR)" > %t.script
# RUN: not lld -flavor gnu2 -o foo %t.script > %t.log 2>&1
# RUN: FileCheck -check-prefix=ERR1 %s < %t.log
More information about the llvm-commits
mailing list