This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Adding support for `cat a.out | size -`
- From: Ahmad Fatoum <ahmad at a3f dot at>
- To: binutils at sourceware dot org
- Date: Sat, 4 Nov 2017 16:48:14 +0100
- Subject: Adding support for `cat a.out | size -`
- Authentication-results: sourceware.org; auth=none
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