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

Nick Clifton nickc@redhat.com
Tue Nov 7 17:33:00 GMT 2017


Hi Ahmad,

> 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.

No, as far as I am aware this has not been raised before.

> * Have bfd_open and friends accept a "-" file name which means slurp stdin into a temp file and open it (and remove atexit(3)).

Sounds good.

> * 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.

Also OK.

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

I did not know about fopencookie, but it looks like it might be quite complicated to use.
If you want to try then by all means give it a go, but please remember the KISS principle.
(Keep It Simple, Sir).

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

No - make the changes in the bfd library.


> 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?

Yes.  Presumably "--" would be the appropriate flag.


Three more points.  Firstly thanks for volunteering to work on this feature.  It is always
nice new contributors bring enhancements to the tools.

Secondly, do you have an FSF copyright assignment for the binutils in place ?  If not, you
will need to get one before you can contribute any patches.  (See the attached form)

Lastly, it will be of a great help if you can follow the GNU Coding Standards when you write
your code: https://www.gnu.org/prep/standards/

Cheers
  Nick

-------------- next part --------------
Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]


[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]


[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]


[For the copyright registration, what country are you a citizen of?]


[What year were you born?]


[Please write your email address here.]


[Please write your postal address here.]





[Which files have you changed so far, and which new files have you written
so far?]


More information about the Binutils mailing list