[Bug 246015] readelf -S truncates section names
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Feb 2 14:26:44 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246015
--- Comment #1 from Ed Maste <emaste at freebsd.org> ---
Indeed, creating a test file via
$ objcopy -I binary -O elf64-x86-64 -B x86-64 --rename-section
.data=.this-is-a-really-long-name empty output.elf
ELF Tool Chain readelf by default shows:
$ readelf -S output.elf
There are 5 section headers, starting at offset 0x78:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .this-is-a-really PROGBITS 0000000000000000 00000040
0000000000000000 0000000000000000 WA 0 0 1
[ 2] .shstrtab STRTAB 0000000000000000 00000040
0000000000000038 0000000000000000 0 0 1
[ 3] .symtab SYMTAB 0000000000000000 000001b8
0000000000000078 0000000000000018 4 2 8
[ 4] .strtab STRTAB 0000000000000000 00000230
000000000000003a 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
GNU readelf 2.33.1 shows:
$ /usr/local/bin/readelf -S output.elf
There are 5 section headers, starting at offset 0x78:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .this-is-a-really PROGBITS 0000000000000000 00000040
0000000000000000 0000000000000000 WA 0 0 1
[ 2] .shstrtab STRTAB 0000000000000000 00000040
0000000000000038 0000000000000000 0 0 1
[ 3] .symtab SYMTAB 0000000000000000 000001b8
0000000000000078 0000000000000018 4 2 8
[ 4] .strtab STRTAB 0000000000000000 00000230
000000000000003a 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
(These differ only in the key.)
With -W GNU readelf shows:
$ /usr/local/bin/readelf -S -W output.elf
There are 5 section headers, starting at offset 0x78:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .this-is-a-really-long-name PROGBITS 0000000000000000 000040
000000 00 WA 0 0 1
[ 2] .shstrtab STRTAB 0000000000000000 000040 000038 00
0 0 1
[ 3] .symtab SYMTAB 0000000000000000 0001b8 000078 18
4 2 8
[ 4] .strtab STRTAB 0000000000000000 000230 00003a 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
While ELF Tool Chain prints on one line but does not widen the name:
$ readelf -S -W output.elf
There are 5 section headers, starting at offset 0x78:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .this-is-a-really PROGBITS 0000000000000000 000040 000000 00 WA
0 0 1
[ 2] .shstrtab STRTAB 0000000000000000 000040 000038 00
0 0 1
[ 3] .symtab SYMTAB 0000000000000000 0001b8 000078 18
4 2 8
[ 4] .strtab STRTAB 0000000000000000 000230 00003a 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-toolchain
mailing list