[lld] r250115 - [ELF2/LinkerScript] Implement parsing of OUTPUT_ARCH() command.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 14:50:08 PDT 2015
Author: davide
Date: Mon Oct 12 16:50:08 2015
New Revision: 250115
URL: http://llvm.org/viewvc/llvm-project?rev=250115&view=rev
Log:
[ELF2/LinkerScript] Implement parsing of OUTPUT_ARCH() command.
Differential Revision: http://reviews.llvm.org/D13675
Added:
lld/trunk/test/elf2/linkerscript-outputarch.s
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=250115&r1=250114&r2=250115&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Oct 12 16:50:08 2015
@@ -45,6 +45,7 @@ private:
void readGroup();
void readInclude();
void readOutput();
+ void readOutputArch();
void readOutputFormat();
void readSearchDir();
@@ -65,6 +66,8 @@ void LinkerScript::run() {
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 @@ void LinkerScript::readOutput() {
expect(")");
}
+void LinkerScript::readOutputArch() {
+ // Error checking only for now.
+ expect("(");
+ next();
+ expect(")");
+}
+
void LinkerScript::readOutputFormat() {
// Error checking only for now.
expect("(");
Added: lld/trunk/test/elf2/linkerscript-outputarch.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/linkerscript-outputarch.s?rev=250115&view=auto
==============================================================================
--- lld/trunk/test/elf2/linkerscript-outputarch.s (added)
+++ lld/trunk/test/elf2/linkerscript-outputarch.s Mon Oct 12 16:50:08 2015
@@ -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
More information about the llvm-commits
mailing list