Readelf section header printing alignment

Pete Dietl petedietl@gmail.com
Tue Dec 26 23:01:16 GMT 2023


The section headers output from readelf with the '-W' option become ugly and
unaligned when a section name is too long.
Example:

Section Headers:
  [Nr] Name              Type            Address          Off    Size
 ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000
000000 00      0   0  0
  [ 1] .text             PROGBITS        0000000000000000 000040
00000f 00  AX  0   0  1
  [ 2] .data             PROGBITS        0000000000000000 00004f
000000 00  WA  0   0  1
  [ 3] .bss              NOBITS          0000000000000000 00004f
000000 00  WA  0   0  1
  [ 4] .comment          PROGBITS        0000000000000000 00004f
00002c 01  MS  0   0  1
  [ 5] .note.GNU-stack   PROGBITS        0000000000000000 00007b
000000 00      0   0  1
  [ 6] .note.gnu.property NOTE            0000000000000000 000080
000020 00   A  0   0  8
  [ 7] .eh_frame         PROGBITS        0000000000000000 0000a0
000038 00   A  0   0  8
  [ 8] .rela.eh_frame    RELA            0000000000000000 000148
000018 18   I  9   7  8
  [ 9] .symtab           SYMTAB          0000000000000000 0000d8
000060 18     10   3  8
  [10] .strtab           STRTAB          0000000000000000 000138
00000d 00      0   0  1
  [11] .shstrtab         STRTAB          0000000000000000 000160
000067 00      0   0  1

May I submit a patch to compute the amount of space between 'Name' and 'Type'
from the longest of the section header names, or is this just a silly
formatting detail that no one cares about? :)

Thanks,
Pete


More information about the Binutils mailing list