[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:52:13 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL250115: [ELF2/LinkerScript] Implement parsing of OUTPUT_ARCH() command. (authored by davide).

Changed prior to commit:
  http://reviews.llvm.org/D13675?vs=37176&id=37180#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13675

Files:
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/test/elf2/linkerscript-outputarch.s

Index: lld/trunk/test/elf2/linkerscript-outputarch.s
===================================================================
--- lld/trunk/test/elf2/linkerscript-outputarch.s
+++ lld/trunk/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: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/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.37180.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/49e5601c/attachment.bin>


More information about the llvm-commits mailing list