[diffoscope] [PATCH] Implement ElfFile as a container of sections

Jérémy Bobbio lunar at debian.org
Sun Jan 3 17:58:36 CET 2016

> I agree that having a dispatch table would be much nicer. Unfortunately
> (correct me if I'm missing something) I believe that the column type
> from the `readelf --section-headers` output is not enough to know how to
> deal with each section. For example, .text has code (to be disassembled)
> .rodata has bytes (to be shown as a hex dump) and .comment has strings
> (to be searched for strings to display), but they all show the same
> type: PROGBITS:
> >   [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
> >   [14] .text             PROGBITS        0000000000408dc0 008dc0 070902 00  AX  0   0 16
> >   [16] .rodata           PROGBITS        00000000004796d0 0796d0 022d18 00   A  0   0 16
> >   [28] .comment          PROGBITS        0000000000000000 0b29a4 000086 01  MS  0   0  1

How about looking at the flags column?

The end of the `--section-headers` output reads:

    Key to Flags:
      W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
      I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
      O (extra OS processing required) o (OS specific), p (processor specific)

Code will have an 'X' flag and strings have an 'S' flag. The rest can
use binary dumps.

What do you think?

Lunar                                .''`. 
lunar at debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.reproducible-builds.org/pipermail/diffoscope/attachments/20160103/fa535960/attachment.sig>

More information about the diffoscope mailing list