[Toybox] [PATCH] readelf: Zero Pad -S section numbers (More scriptable through cut/awk)

Oliver Webb aquahobbyist at proton.me
Fri Apr 26 09:18:03 PDT 2024


On Fri, Apr 26, 2024 at 10:35, enh via Toybox <[toybox at lists.landley.net](mailto:On Fri, Apr 26, 2024 at 10:35, enh via Toybox <<a href=)> wrote:

> but this isn't what anyone else's readelf does...
>
> so now anyone scripting has _two_ problems. (or a bug, if they've only
> tested against toybox.

Our readelf -S doesn’t format things in a way anyone
else’s does. GNU readelf doesn’t do that, llvm readelf
apparently doesn’t. Changing the output format to be
more scriptable wont change that fact…

Meanwhile, I can’t pipe the output of this through sort
or grab values with cut and run xxd -s [offset] -l [size]
and get a hexdump of the section without accounting
for the fact that a section number is sometimes 2 fields.

It’s the “rule of composition” conflicting with “Thou shalt
not break userspace”. The thing is that we already “broke
Userspace” by doing something different than what gnu/llvm does.
Are there actual android scripts using toybox readelf -S?

> honestly, if you're scripting, you should switch to llvm-readelf and
> its less-machine-unreadable alternative output format instead.

The LLVM tool chain is hundreds of megabytes, toybox
0.8.11 dynamically linked with glibc on amd64 is 512 KB

> - Oliver Webb <aquahobbyist at proton.me>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240426/f29299c3/attachment.htm>


More information about the Toybox mailing list