This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Adding support for `cat a.out | size -`


Hello,

I think the ability to pipe files into size(1) (and maybe other binutils) would be convenient. e.g.
./scripts/extract-vmlinuz | size -
echo "$SHELLCODE" | objdump -D -bbinary -mi386 -

I'd like to contribute a patch for that, but want first to make sure this wasn't suggested and rejected before.
If it's a desirable addition, I need some input on how I should go about it:

* Have bfd_open and friends accept a "-" file name which means slurp stdin into a temp file and open it (and remove atexit(3)).
  llvm-size does it this way (sans atexit).

* Have bfd_open* accept a NULL parameter to mean the same. I prefer that so that size -- - may still be used to access a - file and the library interface stays backwards compatible.

* Use the above only as fallback in case fopencookie or equivalent aren't available

* Limit all modifications to the binutils and don't touch any bfd_* library functions


In any case, this would still be a breaking change, because size - reads a - file at the moment. Should I add a command line flag?

Cheers,
Ahmad Fatoum

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]