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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 13:12:04 PDT 2016


How about using od instead of hexdump? od is in POSIX, distributed as part
of GNU coreutils, and exists since version 1 AT&T Unix (according to
Wikipedia,) so I assume it's universally available.

On Fri, Sep 2, 2016 at 12:56 PM, Tom Stellard <tom at stellard.net> wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160902/f7e97546/attachment.html>


More information about the llvm-commits mailing list