[PATCH] D50105: Allow oformat option to accept elf format
Rumeet Dhindsa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 14:34:35 PDT 2018
rdhindsa created this revision.
rdhindsa added a reviewer: ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Allow oformat to accept format starting with elf as acceptable format. isOutputFormatBinary returns false in such case.
Example: --oformat elf64-x86-64
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D50105
Files:
lld/ELF/Driver.cpp
lld/test/ELF/oformat-elf.s
Index: lld/test/ELF/oformat-elf.s
===================================================================
--- /dev/null
+++ lld/test/ELF/oformat-elf.s
@@ -0,0 +1,19 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+# RUN: ld.lld -o %t.out %t --oformat elf64-x86-64
+# RUN: od -t x1 -v %t.out | FileCheck %s
+# CHECK: 0000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
+# CHECK: 0010000 90 11 22 cc cc cc cc cc cc cc cc cc cc cc cc cc
+
+.text
+.align 4
+.globl _start
+_start:
+ nop
+
+.section .mysec.1,"ax"
+.byte 0x11
+
+.section .mysec.2,"ax"
+.byte 0x22
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -501,6 +501,8 @@
StringRef S = Arg->getValue();
if (S == "binary")
return true;
+ if (S.startswith("elf"))
+ return false;
error("unknown --oformat value: " + S);
}
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50105.158388.patch
Type: text/x-patch
Size: 977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/2faa69cf/attachment.bin>
More information about the llvm-commits
mailing list