[PATCH] D13542: [ELF2/LinkerScript] Support for SEARCH_DIR() directive
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 18:03:14 PDT 2015
davide created this revision.
davide added a reviewer: ruiu.
davide added subscribers: emaste, llvm-commits.
Needed by FreeBSD base system.
http://reviews.llvm.org/D13542
Files:
ELF/LinkerScript.cpp
test/elf2/linkerscript.s
Index: test/elf2/linkerscript.s
===================================================================
--- test/elf2/linkerscript.s
+++ test/elf2/linkerscript.s
@@ -23,6 +23,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 ld.lld2 -o foo %t.script > %t.log 2>&1
# RUN: FileCheck -check-prefix=ERR1 %s < %t.log
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -40,6 +40,7 @@
void readGroup();
void readOutput();
void readOutputFormat();
+ void readSearchDir();
std::vector<StringRef> Tokens;
size_t Pos = 0;
@@ -55,6 +56,8 @@
readOutput();
} else if (Tok == "OUTPUT_FORMAT") {
readOutputFormat();
+ } else if (Tok == "SEARCH_DIR") {
+ readSearchDir();
} else {
error("unknown directive: " + Tok);
}
@@ -161,6 +164,13 @@
expect(")");
}
+void LinkerScript::readSearchDir() {
+ expect("(");
+ StringRef Tok = next();
+ Config->InputSearchPaths.push_back(Tok);
+ expect(")");
+}
+
// Entry point. The other functions or classes are private to this file.
void lld::elf2::readLinkerScript(MemoryBufferRef MB) {
LinkerScript(MB.getBuffer()).run();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13542.36817.patch
Type: text/x-patch
Size: 1419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151008/9cfdee1d/attachment.bin>
More information about the llvm-commits
mailing list