[PATCH] D13675: [ELF2/Linkerscript] Implement parsing of OUTPUT_ARCH() command
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 14:27:08 PDT 2015
davide created this revision.
davide added reviewers: ruiu, rafael.
davide added a subscriber: llvm-commits.
Needed by FreeBSD kernel linker script.
http://reviews.llvm.org/D13675
Files:
ELF/LinkerScript.cpp
test/elf2/linkerscript-outputarch.s
Index: test/elf2/linkerscript-outputarch.s
===================================================================
--- test/elf2/linkerscript-outputarch.s
+++ test/elf2/linkerscript-outputarch.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: echo "OUTPUT_ARCH(x)" > %t.script
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
+# RUN: ld.lld2 -shared -o %t2 %t1 %t.script
+# RUN: llvm-readobj %t2 > /dev/null
+
+# RUN: echo "OUTPUT_ARCH(x, y)" > %t.script
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
+# RUN: not ld.lld2 -shared -o %t2 %t1 %t.script
+# RUN: llvm-readobj %t2 > /dev/null
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -45,6 +45,7 @@
void readGroup();
void readInclude();
void readOutput();
+ void readOutputArch();
void readOutputFormat();
void readSearchDir();
@@ -65,6 +66,8 @@
readInclude();
} else if (Tok == "OUTPUT") {
readOutput();
+ } else if (Tok == "OUTPUT_ARCH") {
+ readOutputArch();
} else if (Tok == "OUTPUT_FORMAT") {
readOutputFormat();
} else if (Tok == "SEARCH_DIR") {
@@ -208,6 +211,13 @@
expect(")");
}
+void LinkerScript::readOutputArch() {
+ // Error checking only for now.
+ expect("(");
+ next();
+ expect(")");
+}
+
void LinkerScript::readOutputFormat() {
// Error checking only for now.
expect("(");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13675.37176.patch
Type: text/x-patch
Size: 1460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/34c7a708/attachment.bin>
More information about the llvm-commits
mailing list