[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/23694] New: readelf doesn't handle empty .bss section corr
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug binutils/23694] New: readelf doesn't handle empty .bss section correctly |
Date: |
Thu, 20 Sep 2018 17:33:34 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23694
Bug ID: 23694
Summary: readelf doesn't handle empty .bss section correctly
Product: binutils
Version: 2.32 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
Created attachment 11267
--> https://sourceware.org/bugzilla/attachment.cgi?id=11267&action=edit
A testcase
address@hidden binutils]$ ./readelf -WlS /tmp/dump
There are 12 section headers, starting at offset 0x8544:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf
Al
[ 0] NULL 00000000 000000 000000 00 0 0
0
[ 1] .text PROGBITS 00008000 0000b4 000004 00 AX 0 0
4
[ 2] .bss NOBITS 00010004 0080dc 000000 00 WA 0 0
1
[ 3] .note.4 NOTE 00010078 008150 000028 00 A 0 0
8
[ 4] .note.1 NOTE 000100a0 008178 000028 00 A 0 0
8
[ 5] .note.gnu.build-id NOTE 00010004 0080b8 000024 00 A 0 0
4
[ 6] .note.2 NOTE 00010028 008100 000028 00 A 0 0
4
[ 7] .note.3 NOTE 00010050 008128 000028 00 A 0 0
4
[ 8] .ARM.attributes ARM_ATTRIBUTES 00000000 0081a0 000014 00 0 0
1
[ 9] .symtab SYMTAB 00000000 0081b4 000260 10 10 24
4
[10] .strtab STRTAB 00000000 008414 0000c5 00 0 0
1
[11] .shstrtab STRTAB 00000000 0084d9 000069 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),
y (purecode), p (processor specific)
Elf file type is EXEC (Executable file)
Entry point 0x8000
There are 4 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x0000b4 0x00008000 0x00008000 0x08028 0x08028 R E 0x4
LOAD 0x0080dc 0x00010004 0x00010004 0x000c4 0x000c4 RW 0x8
NOTE 0x008150 0x00010078 0x00010078 0x00050 0x00050 R 0x8
NOTE 0x0080b8 0x00010004 0x00010004 0x00098 0x00074 R 0x4
Section to Segment mapping:
Segment Sections...
00 .text .bss .note.gnu.build-id
01 .bss .note.4 .note.1 .note.2 .note.3
02 .note.4 .note.1
03 .bss .note.gnu.build-id .note.2 .note.3
address@hidden binutils]$
Since .bss section is empty, it shouldn't be included in PT_NOTE segment:
address@hidden binutils]$ eu-readelf -WlS /tmp/dump
There are 12 section headers, starting at offset 0x8544:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf
Al
[ 0] NULL 00000000 000000 000000 0 0 0
0
[ 1] .text PROGBITS 00008000 0000b4 000004 0 AX 0 0
4
[ 2] .bss NOBITS 00010004 0080dc 000000 0 WA 0 0
1
[ 3] .note.4 NOTE 00010078 008150 000028 0 A 0 0
8
[ 4] .note.1 NOTE 000100a0 008178 000028 0 A 0 0
8
[ 5] .note.gnu.build-id NOTE 00010004 0080b8 000024 0 A 0 0
4
[ 6] .note.2 NOTE 00010028 008100 000028 0 A 0 0
4
[ 7] .note.3 NOTE 00010050 008128 000028 0 A 0 0
4
[ 8] .ARM.attributes ARM_ATTRIBUTES 00000000 0081a0 000014 0 0 0
1
[ 9] .symtab SYMTAB 00000000 0081b4 000260 16 10 24
4
[10] .strtab STRTAB 00000000 008414 0000c5 0 0 0
1
[11] .shstrtab STRTAB 00000000 0084d9 000069 0 0 0
1
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x0000b4 0x00008000 0x00008000 0x008028 0x008028 R E 0x4
LOAD 0x0080dc 0x00010004 0x00010004 0x0000c4 0x0000c4 RW 0x8
NOTE 0x008150 0x00010078 0x00010078 0x000050 0x000050 R 0x8
NOTE 0x0080b8 0x00010004 0x00010004 0x000098 0x000074 R 0x4
Section to Segment mapping:
Segment Sections...
00 [RO: .text .note.gnu.build-id]
01 .note.4 .note.1 [RO: .note.gnu.build-id] .note.2 .note.3
02 .note.4 .note.1
03 [RO: .note.gnu.build-id] .note.2 .note.3
address@hidden binutils]$
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/23694] New: readelf doesn't handle empty .bss section correctly,
hjl.tools at gmail dot com <=