Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion format/elf/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,15 @@ func elfDecodeSectionHeader(d *decode.D, ec elfContext, sh sectionHeader) {
entSize = int64(d.FieldU64("entsize") * 8)
}

if typ == SHT_NOBITS {
// SHT_NOBITS:
// A section of this type occupies no space in the file but otherwise resembles
// SHT_PROGBITS. Although this section contains no bytes, the sh_offset member
// contains the conceptual file offset.
// SHT_NULL:
// This value marks the section header as inactive; it does not have an
// associated section. Other members of the section header have undefined
// values.
if typ == SHT_NOBITS || typ == SHT_NULL {
// section occupies no space in file
return
}
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_386/a_dynamic.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ $ fq -d elf dv a_dynamic
0x01b0|01 00 00 00 |.... | align: 1 0x1b0-0x1b4 (4)
0x2ef0|ff ff ff ff 00 00 00 00 ff ff ff ff 00 00 00 00|................| data: raw bits 0x2ef0-0x3000 (272)
* |until 0x2fff.7 (272) | |
| | | section_headers[0:34]: 0x0-0x41c0 (16832)
| | | [0]{}: section_header 0x0-0x3c98 (15512)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:34]: 0x1b4-0x41c0 (16396)
| | | [0]{}: section_header 0x3c70-0x3c98 (40)
0x3c70|00 00 00 00 |.... | name: "" (0) 0x3c70-0x3c74 (4)
0x3c70| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x3c74-0x3c78 (4)
| | | flags{}: 0x3c78-0x3c7c (4)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_386/a_static.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ $ fq -d elf dv a_static
0x00130|01 00 00 00 |.... | align: 1 0x130-0x134 (4)
0x02fd0|ff ff ff ff 00 00 00 00 ff ff ff ff 00 00 00 00|................| data: raw bits 0x2fd0-0x3000 (48)
* |until 0x2fff.7 (48) | |
| | | section_headers[0:25]: 0x0-0x11760 (71520)
| | | [0]{}: section_header 0x0-0x113a0 (70560)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:25]: 0x134-0x11760 (71212)
| | | [0]{}: section_header 0x11378-0x113a0 (40)
0x11370| 00 00 00 00 | .... | name: "" (0) 0x11378-0x1137c (4)
0x11370| 00 00 00 00| ....| type: "null" (0x0) (Header inactive) 0x1137c-0x11380 (4)
| | | flags{}: 0x11380-0x11384 (4)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_386/a_stripped.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ $ fq -d elf dv a_stripped
0x01b0|01 00 00 00 |.... | align: 1 0x1b0-0x1b4 (4)
0x2ef0|ff ff ff ff 00 00 00 00 ff ff ff ff 00 00 00 00|................| data: raw bits 0x2ef0-0x3000 (272)
* |until 0x2fff.7 (272) | |
| | | section_headers[0:24]: 0x0-0x34b0 (13488)
| | | [0]{}: section_header 0x0-0x3118 (12568)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:24]: 0x1b4-0x34b0 (13052)
| | | [0]{}: section_header 0x30f0-0x3118 (40)
0x30f0|00 00 00 00 |.... | name: "" (0) 0x30f0-0x30f4 (4)
0x30f0| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x30f4-0x30f8 (4)
| | | flags{}: 0x30f8-0x30fc (4)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_386/libbbb.a.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ $ fq -d ar dv libbbb.a
0x0d0| 28 00 | (. | shentsize: 40 0xdc-0xde (2)
0x0d0| 10 00| ..| shnum: 16 0xde-0xe0 (2)
0x0e0|0f 00 |.. | shstrndx: 15 0xe0-0xe2 (2)
| | | section_headers[0:16]: 0xae-0x5ee (1344)
| | | [0]{}: section_header 0xae-0x396 (744)
| | | data: raw bits 0xae-0xae (0)
| | | section_headers[0:16]: 0xe2-0x5ee (1292)
| | | [0]{}: section_header 0x36e-0x396 (40)
0x360| 00 00| ..| name: "" (0) 0x36e-0x372 (4)
0x370|00 00 |.. |
0x370| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x372-0x376 (4)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_386/libbbb.so.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ $ fq -d elf dv libbbb.so
0x2f10| ff ff ff ff 00 00 00 00 ff ff ff ff| ............| data: raw bits 0x2f14-0x3000 (236)
0x2f20|00 00 00 00 01 00 00 00 9c 00 00 00 0c 00 00 00|................|
* |until 0x2fff.7 (236) | |
| | | section_headers[0:31]: 0x0-0x3c70 (15472)
| | | [0]{}: section_header 0x0-0x37c0 (14272)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:31]: 0x174-0x3c70 (15100)
| | | [0]{}: section_header 0x3798-0x37c0 (40)
0x3790| 00 00 00 00 | .... | name: "" (0) 0x3798-0x379c (4)
0x3790| 00 00 00 00| ....| type: "null" (0x0) (Header inactive) 0x379c-0x37a0 (4)
| | | flags{}: 0x37a0-0x37a4 (4)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_amd64/a_dynamic.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ $ fq -d elf dv a_dynamic
0x2df0| ff ff ff ff ff ff ff ff| ........| data: raw bits 0x2df8-0x3000 (520)
0x2e00|00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff|................|
* |until 0x2fff.7 (520) | |
| | | section_headers[0:34]: 0x0-0x4710 (18192)
| | | [0]{}: section_header 0x0-0x3ed0 (16080)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:34]: 0x2e0-0x4710 (17456)
| | | [0]{}: section_header 0x3e90-0x3ed0 (64)
0x3e90|00 00 00 00 |.... | name: "" (0) 0x3e90-0x3e94 (4)
0x3e90| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x3e94-0x3e98 (4)
| | | flags{}: 0x3e98-0x3ea0 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_amd64/a_static.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ $ fq -d elf dv a_static
0x001f0| 01 00 00 00 00 00 00 00| ........| align: 1 0x1f8-0x200 (8)
0x02fd0|ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00|................| data: raw bits 0x2fd0-0x3000 (48)
* |until 0x2fff.7 (48) | |
| | | section_headers[0:24]: 0x0-0x144a0 (83104)
| | | [0]{}: section_header 0x0-0x13ee0 (81632)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:24]: 0x200-0x144a0 (82592)
| | | [0]{}: section_header 0x13ea0-0x13ee0 (64)
0x13ea0|00 00 00 00 |.... | name: "" (0) 0x13ea0-0x13ea4 (4)
0x13ea0| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x13ea4-0x13ea8 (4)
| | | flags{}: 0x13ea8-0x13eb0 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_amd64/a_stripped.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ $ fq -d elf dv a_stripped
0x2df0| ff ff ff ff ff ff ff ff| ........| data: raw bits 0x2df8-0x3000 (520)
0x2e00|00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff|................|
* |until 0x2fff.7 (520) | |
| | | section_headers[0:24]: 0x0-0x36f8 (14072)
| | | [0]{}: section_header 0x0-0x3138 (12600)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:24]: 0x2e0-0x36f8 (13336)
| | | [0]{}: section_header 0x30f8-0x3138 (64)
0x30f0| 00 00 00 00 | .... | name: "" (0) 0x30f8-0x30fc (4)
0x30f0| 00 00 00 00| ....| type: "null" (0x0) (Header inactive) 0x30fc-0x3100 (4)
| | | flags{}: 0x3100-0x3108 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_amd64/libbbb.a.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ $ fq -d ar dv libbbb.a
0x0c0| 40 00| @.| shentsize: 64 0xce-0xd0 (2)
0x0d0|0e 00 |.. | shnum: 14 0xd0-0xd2 (2)
0x0d0| 0d 00 | .. | shstrndx: 13 0xd2-0xd4 (2)
| | | section_headers[0:14]: 0x94-0x67c (1512)
| | | [0]{}: section_header 0x94-0x33c (680)
| | | data: raw bits 0x94-0x94 (0)
| | | section_headers[0:14]: 0xd4-0x67c (1448)
| | | [0]{}: section_header 0x2fc-0x33c (64)
0x2f0| 00 00 00 00| ....| name: "" (0) 0x2fc-0x300 (4)
0x300|00 00 00 00 |.... | type: "null" (0x0) (Header inactive) 0x300-0x304 (4)
| | | flags{}: 0x304-0x30c (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_amd64/libbbb.so.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,8 @@ $ fq -d elf dv libbbb.so
0x2e20| ff ff ff ff ff ff ff ff| ........| data: raw bits 0x2e28-0x3000 (472)
0x2e30|00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff|................|
* |until 0x2fff.7 (472) | |
| | | section_headers[0:31]: 0x0-0x4050 (16464)
| | | [0]{}: section_header 0x0-0x38d0 (14544)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:31]: 0x270-0x4050 (15840)
| | | [0]{}: section_header 0x3890-0x38d0 (64)
0x3890|00 00 00 00 |.... | name: "" (0) 0x3890-0x3894 (4)
0x3890| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x3894-0x3898 (4)
| | | flags{}: 0x3898-0x38a0 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_arm64/a_dynamic.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ $ fq -d elf dv a_dynamic
0x01f0| 01 00 00 00 00 00 00 00| ........| align: 1 0x1f8-0x200 (8)
0x0d90|90 07 00 00 00 00 00 00 30 07 00 00 00 00 00 00|........0.......| data: raw bits 0xd90-0x1000 (624)
* |until 0xfff.7 (624) | |
| | | section_headers[0:32]: 0x0-0x2b40 (11072)
| | | [0]{}: section_header 0x0-0x2380 (9088)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:32]: 0x200-0x2b40 (10560)
| | | [0]{}: section_header 0x2340-0x2380 (64)
0x2340|00 00 00 00 |.... | name: "" (0) 0x2340-0x2344 (4)
0x2340| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x2344-0x2348 (4)
| | | flags{}: 0x2348-0x2350 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_arm64/a_static.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ $ fq -d elf dv a_static
0x01f60| 60 02 40 00 00 00 00 00| `.@.....| data: raw bits 0x1f68-0x2000 (152)
0x01f70|10 02 40 00 00 00 00 00 08 20 41 00 00 00 00 00|..@...... A.....|
* |until 0x1fff.7 (152) | |
| | | section_headers[0:24]: 0x0-0x15560 (87392)
| | | [0]{}: section_header 0x0-0x14fa0 (85920)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:24]: 0x120-0x15560 (87104)
| | | [0]{}: section_header 0x14f60-0x14fa0 (64)
0x14f60|00 00 00 00 |.... | name: "" (0) 0x14f60-0x14f64 (4)
0x14f60| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x14f64-0x14f68 (4)
| | | flags{}: 0x14f68-0x14f70 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_arm64/a_stripped.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ $ fq -d elf dv a_stripped
0x01f0| 01 00 00 00 00 00 00 00| ........| align: 1 0x1f8-0x200 (8)
0x0d90|90 07 00 00 00 00 00 00 30 07 00 00 00 00 00 00|........0.......| data: raw bits 0xd90-0x1000 (624)
* |until 0xfff.7 (624) | |
| | | section_headers[0:22]: 0x0-0x1668 (5736)
| | | [0]{}: section_header 0x0-0x1128 (4392)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:22]: 0x200-0x1668 (5224)
| | | [0]{}: section_header 0x10e8-0x1128 (64)
0x10e0| 00 00 00 00 | .... | name: "" (0) 0x10e8-0x10ec (4)
0x10e0| 00 00 00 00| ....| type: "null" (0x0) (Header inactive) 0x10ec-0x10f0 (4)
| | | flags{}: 0x10f0-0x10f8 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_arm64/libbbb.a.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ $ fq -d ar dv libbbb.a
0x0c0| 40 00| @.| shentsize: 64 0xce-0xd0 (2)
0x0d0|0d 00 |.. | shnum: 13 0xd0-0xd2 (2)
0x0d0| 0c 00 | .. | shstrndx: 12 0xd2-0xd4 (2)
| | | section_headers[0:13]: 0x94-0x6e4 (1616)
| | | [0]{}: section_header 0x94-0x3e4 (848)
| | | data: raw bits 0x94-0x94 (0)
| | | section_headers[0:13]: 0xd4-0x6e4 (1552)
| | | [0]{}: section_header 0x3a4-0x3e4 (64)
0x3a0| 00 00 00 00 | .... | name: "" (0) 0x3a4-0x3a8 (4)
0x3a0| 00 00 00 00 | .... | type: "null" (0x0) (Header inactive) 0x3a8-0x3ac (4)
| | | flags{}: 0x3ac-0x3b4 (8)
Expand Down
5 changes: 2 additions & 3 deletions format/elf/testdata/linux_arm64/libbbb.so.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ $ fq -d elf dv libbbb.so
0x0dd0| f0 05 00 00 00 00 00 00| ........| data: raw bits 0xdd8-0x1000 (552)
0x0de0|90 05 00 00 00 00 00 00 01 00 00 00 00 00 00 00|................|
* |until 0xfff.7 (552) | |
| | | section_headers[0:29]: 0x0-0x2368 (9064)
| | | [0]{}: section_header 0x0-0x1c68 (7272)
| | | data: raw bits 0x0-0x0 (0)
| | | section_headers[0:29]: 0x190-0x2368 (8664)
| | | [0]{}: section_header 0x1c28-0x1c68 (64)
0x1c20| 00 00 00 00 | .... | name: "" (0) 0x1c28-0x1c2c (4)
0x1c20| 00 00 00 00| ....| type: "null" (0x0) (Header inactive) 0x1c2c-0x1c30 (4)
| | | flags{}: 0x1c30-0x1c38 (8)
Expand Down
Loading
Loading