[lld] r279726 - [ELF] - Implemented --oformat binary option.

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 12:56:16 PDT 2016


On Fri, Sep 02, 2016 at 09:09:10AM +0000, George Rimar wrote:
> >> --- lld/trunk/test/ELF/oformat-binary.s (added)
> >> +++ lld/trunk/test/ELF/oformat-binary.s Thu Aug 25 04:05:47 2016
> >> @@ -0,0 +1,28 @@
> >> +# REQUIRES: x86
> >> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
> >> +
> >> +# RUN: ld.lld -o %t.out %t --oformat binary
> >> +# RUN: hexdump -C %t.out | FileCheck %s
> >> +# CHECK: 00000000 90 11 22 00 00 00 00 00
> >> +# CHECK-NOT: 00000010
> >> +
> >> +## Check case when linkerscript is used.
> >> +# RUN: echo "SECTIONS { . = 0x1000; }" > %t.script
> >> +# RUN: ld.lld -o %t2.out --script %t.script %t --oformat binary
> >> +# RUN: hexdump -C %t2.out | FileCheck %s
> >
> >Hi,
> >
> >'hexdump -C' should be replaced with 'llvm-objdump -s' to avoid adding a
> >dependency on an external tool
> >
> >-Tom
> 
> Hi Tom !
> 
> --oformat binary testcase is about checking feature of raw binary ouput.
> So llvm-objdump -s gives me "The file was not recognized as a valid object file" here.
> Not sure if there is something elve is llvm tools that can help here ?
> 

OK, I was looking at the solution for r277771.  Would it work to use a
python one-liner, like:

python -c 'import sys; print [hex(ord(a)) for a in sys.stdin.read()]' < %t.out

-Tom

> George.


More information about the llvm-commits mailing list