diff --git a/format/elf/testdata/linux_386/libbbb.a.fqtest b/format/elf/testdata/linux_386/libbbb.a.fqtest index 5081f3f5..a3d65d97 100644 --- a/format/elf/testdata/linux_386/libbbb.a.fqtest +++ b/format/elf/testdata/linux_386/libbbb.a.fqtest @@ -141,36 +141,7 @@ $ fq -d ar v libbbb.a 0x3d0| 01 00| ..| addralign: 1 0x3de-0x3e1.7 (4) 0x3e0|00 00 |.. | 0x3e0| 00 00 00 00 | .... | entsize: 0 0x3e2-0x3e5.7 (4) - | | | [3]{}: section_header 0x115-0x485.7 (881) -0x110| 6c 69 62 62 62 62 5f 62 62 62 00| libbbb_bbb.| data: raw bits 0x115-0x11f.7 (11) -0x450| 30 00| 0.| name: ".rodata" (48) 0x45e-0x461.7 (4) -0x460|00 00 |.. | -0x460| 01 00 00 00 | .... | type: "progbits" (0x1) (Information defined by the program) 0x462-0x465.7 (4) - | | | flags{}: 0x466-0x469.7 (4) -0x460| 02 | . | link_order: false 0x466-0x466 (0.1) -0x460| 02 | . | info_link: false 0x466.1-0x466.1 (0.1) -0x460| 02 | . | strings: false 0x466.2-0x466.2 (0.1) -0x460| 02 | . | merge: false 0x466.3-0x466.3 (0.1) -0x460| 02 | . | unused0: 0 0x466.4-0x466.4 (0.1) -0x460| 02 | . | execinstr: false 0x466.5-0x466.5 (0.1) -0x460| 02 | . | alloc: true 0x466.6-0x466.6 (0.1) -0x460| 02 | . | write: false 0x466.7-0x466.7 (0.1) -0x460| 00 | . | tls: false 0x467-0x467 (0.1) -0x460| 00 | . | group: false 0x467.1-0x467.1 (0.1) -0x460| 00 | . | os_nonconforming: false 0x467.2-0x467.2 (0.1) -0x460| 00 00 | .. | unused1: 0 0x467.3-0x468.3 (1.1) -0x460| 00 00 | .. | os_specific: 0 0x468.4-0x469.3 (1) -0x460| 00 | . | processor_specific: 0 0x469.4-0x469.7 (0.4) -0x460| 00 00 00 00 | .... | addr: 0x0 0x46a-0x46d.7 (4) -0x460| 67 00| g.| offset: 103 0x46e-0x471.7 (4) -0x470|00 00 |.. | -0x470| 0b 00 00 00 | .... | size: 0xb 0x472-0x475.7 (4) -0x470| 00 00 00 00 | .... | link: 0 0x476-0x479.7 (4) -0x470| 00 00 00 00 | .... | info: 0 0x47a-0x47d.7 (4) -0x470| 01 00| ..| addralign: 1 0x47e-0x481.7 (4) -0x480|00 00 |.. | -0x480| 00 00 00 00 | .... | entsize: 0 0x482-0x485.7 (4) - | | | [4]{}: section_header 0x115-0x435.7 (801) + | | | [3]{}: section_header 0x115-0x435.7 (801) | | | data: raw bits 0x115-NA (0) 0x400| 25 00| %.| name: ".data" (37) 0x40e-0x411.7 (4) 0x410|00 00 |.. | @@ -199,6 +170,35 @@ $ fq -d ar v libbbb.a 0x420| 01 00| ..| addralign: 1 0x42e-0x431.7 (4) 0x430|00 00 |.. | 0x430| 00 00 00 00 | .... | entsize: 0 0x432-0x435.7 (4) + | | | [4]{}: section_header 0x115-0x485.7 (881) +0x110| 6c 69 62 62 62 62 5f 62 62 62 00| libbbb_bbb.| data: raw bits 0x115-0x11f.7 (11) +0x450| 30 00| 0.| name: ".rodata" (48) 0x45e-0x461.7 (4) +0x460|00 00 |.. | +0x460| 01 00 00 00 | .... | type: "progbits" (0x1) (Information defined by the program) 0x462-0x465.7 (4) + | | | flags{}: 0x466-0x469.7 (4) +0x460| 02 | . | link_order: false 0x466-0x466 (0.1) +0x460| 02 | . | info_link: false 0x466.1-0x466.1 (0.1) +0x460| 02 | . | strings: false 0x466.2-0x466.2 (0.1) +0x460| 02 | . | merge: false 0x466.3-0x466.3 (0.1) +0x460| 02 | . | unused0: 0 0x466.4-0x466.4 (0.1) +0x460| 02 | . | execinstr: false 0x466.5-0x466.5 (0.1) +0x460| 02 | . | alloc: true 0x466.6-0x466.6 (0.1) +0x460| 02 | . | write: false 0x466.7-0x466.7 (0.1) +0x460| 00 | . | tls: false 0x467-0x467 (0.1) +0x460| 00 | . | group: false 0x467.1-0x467.1 (0.1) +0x460| 00 | . | os_nonconforming: false 0x467.2-0x467.2 (0.1) +0x460| 00 00 | .. | unused1: 0 0x467.3-0x468.3 (1.1) +0x460| 00 00 | .. | os_specific: 0 0x468.4-0x469.3 (1) +0x460| 00 | . | processor_specific: 0 0x469.4-0x469.7 (0.4) +0x460| 00 00 00 00 | .... | addr: 0x0 0x46a-0x46d.7 (4) +0x460| 67 00| g.| offset: 103 0x46e-0x471.7 (4) +0x470|00 00 |.. | +0x470| 0b 00 00 00 | .... | size: 0xb 0x472-0x475.7 (4) +0x470| 00 00 00 00 | .... | link: 0 0x476-0x479.7 (4) +0x470| 00 00 00 00 | .... | info: 0 0x47a-0x47d.7 (4) +0x470| 01 00| ..| addralign: 1 0x47e-0x481.7 (4) +0x480|00 00 |.. | +0x480| 00 00 00 00 | .... | entsize: 0 0x482-0x485.7 (4) | | | [5]{}: section_header 0x120-0x4ad.7 (910) 0x120|8b 04 24 c3 |..$. | data: raw bits 0x120-0x123.7 (4) 0x480| 38 00 00 00 | 8... | name: ".text.__x86.get_pc_thunk.ax" (56) 0x486-0x489.7 (4) diff --git a/format/elf/testdata/linux_amd64/libbbb.a.fqtest b/format/elf/testdata/linux_amd64/libbbb.a.fqtest index f6292c87..d4b5672a 100644 --- a/format/elf/testdata/linux_amd64/libbbb.a.fqtest +++ b/format/elf/testdata/linux_amd64/libbbb.a.fqtest @@ -207,7 +207,37 @@ $ fq -d ar v libbbb.a 0x4a0| 01 00 00 00| ....| addralign: 1 0x4ac-0x4b3.7 (8) 0x4b0|00 00 00 00 |.... | 0x4b0| 01 00 00 00 00 00 00 00 | ........ | entsize: 1 0x4b4-0x4bb.7 (8) - | | | [5]{}: section_header 0x124-0x53b.7 (1048) + | | | [5]{}: section_header 0x124-0x4fb.7 (984) + | | | data: raw bits 0x124-NA (0) +0x4b0| 42 00 00 00| B...| name: ".note.GNU-stack" (66) 0x4bc-0x4bf.7 (4) +0x4c0|01 00 00 00 |.... | type: "progbits" (0x1) (Information defined by the program) 0x4c0-0x4c3.7 (4) + | | | flags{}: 0x4c4-0x4cb.7 (8) +0x4c0| 00 | . | link_order: false 0x4c4-0x4c4 (0.1) +0x4c0| 00 | . | info_link: false 0x4c4.1-0x4c4.1 (0.1) +0x4c0| 00 | . | strings: false 0x4c4.2-0x4c4.2 (0.1) +0x4c0| 00 | . | merge: false 0x4c4.3-0x4c4.3 (0.1) +0x4c0| 00 | . | unused0: 0 0x4c4.4-0x4c4.4 (0.1) +0x4c0| 00 | . | execinstr: false 0x4c4.5-0x4c4.5 (0.1) +0x4c0| 00 | . | alloc: false 0x4c4.6-0x4c4.6 (0.1) +0x4c0| 00 | . | write: false 0x4c4.7-0x4c4.7 (0.1) +0x4c0| 00 | . | tls: false 0x4c5-0x4c5 (0.1) +0x4c0| 00 | . | group: false 0x4c5.1-0x4c5.1 (0.1) +0x4c0| 00 | . | os_nonconforming: false 0x4c5.2-0x4c5.2 (0.1) +0x4c0| 00 00 | .. | unused1: 0 0x4c5.3-0x4c6.3 (1.1) +0x4c0| 00 00 | .. | os_specific: 0 0x4c6.4-0x4c7.3 (1) +0x4c0| 00 | . | processor_specific: 0 0x4c7.4-0x4c7.7 (0.4) +0x4c0| 00 00 00 00 | .... | unused2: 0 0x4c8-0x4cb.7 (4) +0x4c0| 00 00 00 00| ....| addr: 0x0 0x4cc-0x4d3.7 (8) +0x4d0|00 00 00 00 |.... | +0x4d0| 90 00 00 00 00 00 00 00 | ........ | offset: 0x90 0x4d4-0x4db.7 (8) +0x4d0| 00 00 00 00| ....| size: 0 0x4dc-0x4e3.7 (8) +0x4e0|00 00 00 00 |.... | +0x4e0| 00 00 00 00 | .... | link: 0 0x4e4-0x4e7.7 (4) +0x4e0| 00 00 00 00 | .... | info: 0 0x4e8-0x4eb.7 (4) +0x4e0| 01 00 00 00| ....| addralign: 1 0x4ec-0x4f3.7 (8) +0x4f0|00 00 00 00 |.... | +0x4f0| 00 00 00 00 00 00 00 00 | ........ | entsize: 0 0x4f4-0x4fb.7 (8) + | | | [6]{}: section_header 0x124-0x53b.7 (1048) 0x120| 04 00 00 00 20 00 00 00 05 00 00 00| .... .......| data: raw bits 0x124-0x153.7 (48) 0x130|47 4e 55 00 02 00 01 c0 04 00 00 00 00 00 00 00|GNU.............| * |until 0x153.7 (48) | | @@ -239,36 +269,6 @@ $ fq -d ar v libbbb.a 0x520| 08 00 00 00| ....| addralign: 8 0x52c-0x533.7 (8) 0x530|00 00 00 00 |.... | 0x530| 00 00 00 00 00 00 00 00 | ........ | entsize: 0 0x534-0x53b.7 (8) - | | | [6]{}: section_header 0x124-0x4fb.7 (984) - | | | data: raw bits 0x124-NA (0) -0x4b0| 42 00 00 00| B...| name: ".note.GNU-stack" (66) 0x4bc-0x4bf.7 (4) -0x4c0|01 00 00 00 |.... | type: "progbits" (0x1) (Information defined by the program) 0x4c0-0x4c3.7 (4) - | | | flags{}: 0x4c4-0x4cb.7 (8) -0x4c0| 00 | . | link_order: false 0x4c4-0x4c4 (0.1) -0x4c0| 00 | . | info_link: false 0x4c4.1-0x4c4.1 (0.1) -0x4c0| 00 | . | strings: false 0x4c4.2-0x4c4.2 (0.1) -0x4c0| 00 | . | merge: false 0x4c4.3-0x4c4.3 (0.1) -0x4c0| 00 | . | unused0: 0 0x4c4.4-0x4c4.4 (0.1) -0x4c0| 00 | . | execinstr: false 0x4c4.5-0x4c4.5 (0.1) -0x4c0| 00 | . | alloc: false 0x4c4.6-0x4c4.6 (0.1) -0x4c0| 00 | . | write: false 0x4c4.7-0x4c4.7 (0.1) -0x4c0| 00 | . | tls: false 0x4c5-0x4c5 (0.1) -0x4c0| 00 | . | group: false 0x4c5.1-0x4c5.1 (0.1) -0x4c0| 00 | . | os_nonconforming: false 0x4c5.2-0x4c5.2 (0.1) -0x4c0| 00 00 | .. | unused1: 0 0x4c5.3-0x4c6.3 (1.1) -0x4c0| 00 00 | .. | os_specific: 0 0x4c6.4-0x4c7.3 (1) -0x4c0| 00 | . | processor_specific: 0 0x4c7.4-0x4c7.7 (0.4) -0x4c0| 00 00 00 00 | .... | unused2: 0 0x4c8-0x4cb.7 (4) -0x4c0| 00 00 00 00| ....| addr: 0x0 0x4cc-0x4d3.7 (8) -0x4d0|00 00 00 00 |.... | -0x4d0| 90 00 00 00 00 00 00 00 | ........ | offset: 0x90 0x4d4-0x4db.7 (8) -0x4d0| 00 00 00 00| ....| size: 0 0x4dc-0x4e3.7 (8) -0x4e0|00 00 00 00 |.... | -0x4e0| 00 00 00 00 | .... | link: 0 0x4e4-0x4e7.7 (4) -0x4e0| 00 00 00 00 | .... | info: 0 0x4e8-0x4eb.7 (4) -0x4e0| 01 00 00 00| ....| addralign: 1 0x4ec-0x4f3.7 (8) -0x4f0|00 00 00 00 |.... | -0x4f0| 00 00 00 00 00 00 00 00 | ........ | entsize: 0 0x4f4-0x4fb.7 (8) | | | [7]{}: section_header 0x154-0x57b.7 (1064) 0x150| 14 00 00 00 00 00 00 00 01 7a 52 00| .........zR.| data: raw bits 0x154-0x18b.7 (56) 0x160|01 78 10 01 1b 0c 07 08 90 01 00 00 1c 00 00 00|.x..............| diff --git a/format/elf/testdata/linux_arm64/a_dynamic.fqtest b/format/elf/testdata/linux_arm64/a_dynamic.fqtest index b452a5ea..eb47eb2e 100644 --- a/format/elf/testdata/linux_arm64/a_dynamic.fqtest +++ b/format/elf/testdata/linux_arm64/a_dynamic.fqtest @@ -23,23 +23,7 @@ $ fq -d elf v a_dynamic 0x0030| 20 00 | . | shnum: 32 0x3c-0x3d.7 (2) 0x0030| 1f 00| ..| shstrndx: 31 0x3e-0x3f.7 (2) | | | program_headers[0:8]: 0x0-0x1007.7 (4104) - | | | [0]{}: program_header 0x0-0x1c7.7 (456) - | | | program_header{}: 0x0-0x1c7.7 (456) - | | | data: raw bits 0x0-NA (0) -0x0190|51 e5 74 64 |Q.td | type: "gnu_stack" (1685382481) (GNU stack permission) 0x190-0x193.7 (4) - | | | flags{}: 0x194-0x197.7 (4) -0x0190| 06 | . | unused0: 0 0x194-0x194.4 (0.5) -0x0190| 06 | . | r: true 0x194.5-0x194.5 (0.1) -0x0190| 06 | . | w: true 0x194.6-0x194.6 (0.1) -0x0190| 06 | . | x: false 0x194.7-0x194.7 (0.1) -0x0190| 00 00 00 | ... | unused1: 0 0x195-0x197.7 (3) -0x0190| 00 00 00 00 00 00 00 00| ........| offset: 0x0 0x198-0x19f.7 (8) -0x01a0|00 00 00 00 00 00 00 00 |........ | vaddr: 0x0 0x1a0-0x1a7.7 (8) -0x01a0| 00 00 00 00 00 00 00 00| ........| paddr: 0x0 0x1a8-0x1af.7 (8) -0x01b0|00 00 00 00 00 00 00 00 |........ | filesz: 0 0x1b0-0x1b7.7 (8) -0x01b0| 00 00 00 00 00 00 00 00| ........| memsz: 0 0x1b8-0x1bf.7 (8) -0x01c0|10 00 00 00 00 00 00 00 |........ | align: 16 0x1c0-0x1c7.7 (8) - | | | [1]{}: program_header 0x0-0x913.7 (2324) + | | | [0]{}: program_header 0x0-0x913.7 (2324) | | | program_header{}: 0x0-0x913.7 (2324) 0x0000|7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00|.ELF............| data: raw bits 0x0-0x913.7 (2324) * |until 0x913.7 (2324) | | @@ -56,6 +40,22 @@ $ fq -d elf v a_dynamic 0x00d0|14 09 00 00 00 00 00 00 |........ | filesz: 2324 0xd0-0xd7.7 (8) 0x00d0| 14 09 00 00 00 00 00 00| ........| memsz: 2324 0xd8-0xdf.7 (8) 0x00e0|00 00 01 00 00 00 00 00 |........ | align: 65536 0xe0-0xe7.7 (8) + | | | [1]{}: program_header 0x0-0x1c7.7 (456) + | | | program_header{}: 0x0-0x1c7.7 (456) + | | | data: raw bits 0x0-NA (0) +0x0190|51 e5 74 64 |Q.td | type: "gnu_stack" (1685382481) (GNU stack permission) 0x190-0x193.7 (4) + | | | flags{}: 0x194-0x197.7 (4) +0x0190| 06 | . | unused0: 0 0x194-0x194.4 (0.5) +0x0190| 06 | . | r: true 0x194.5-0x194.5 (0.1) +0x0190| 06 | . | w: true 0x194.6-0x194.6 (0.1) +0x0190| 06 | . | x: false 0x194.7-0x194.7 (0.1) +0x0190| 00 00 00 | ... | unused1: 0 0x195-0x197.7 (3) +0x0190| 00 00 00 00 00 00 00 00| ........| offset: 0x0 0x198-0x19f.7 (8) +0x01a0|00 00 00 00 00 00 00 00 |........ | vaddr: 0x0 0x1a0-0x1a7.7 (8) +0x01a0| 00 00 00 00 00 00 00 00| ........| paddr: 0x0 0x1a8-0x1af.7 (8) +0x01b0|00 00 00 00 00 00 00 00 |........ | filesz: 0 0x1b0-0x1b7.7 (8) +0x01b0| 00 00 00 00 00 00 00 00| ........| memsz: 0 0x1b8-0x1bf.7 (8) +0x01c0|10 00 00 00 00 00 00 00 |........ | align: 16 0x1c0-0x1c7.7 (8) | | | [2]{}: program_header 0x40-0x1ff.7 (448) | | | program_header{}: 0x40-0x1ff.7 (448) 0x0040|06 00 00 00 |.... | type: "phdr" (6) (Program header location and size) 0x40-0x43.7 (4) diff --git a/format/elf/testdata/linux_arm64/a_static.fqtest b/format/elf/testdata/linux_arm64/a_static.fqtest index 1ac7af4f..e1c78d27 100644 --- a/format/elf/testdata/linux_arm64/a_static.fqtest +++ b/format/elf/testdata/linux_arm64/a_static.fqtest @@ -23,23 +23,7 @@ $ fq -d elf v a_static 0x0030| 20 00 | . | shnum: 32 0x3c-0x3d.7 (2) 0x0030| 1f 00| ..| shstrndx: 31 0x3e-0x3f.7 (2) | | | program_headers[0:8]: 0x0-0x1007.7 (4104) - | | | [0]{}: program_header 0x0-0x1c7.7 (456) - | | | program_header{}: 0x0-0x1c7.7 (456) - | | | data: raw bits 0x0-NA (0) -0x0190|51 e5 74 64 |Q.td | type: "gnu_stack" (1685382481) (GNU stack permission) 0x190-0x193.7 (4) - | | | flags{}: 0x194-0x197.7 (4) -0x0190| 06 | . | unused0: 0 0x194-0x194.4 (0.5) -0x0190| 06 | . | r: true 0x194.5-0x194.5 (0.1) -0x0190| 06 | . | w: true 0x194.6-0x194.6 (0.1) -0x0190| 06 | . | x: false 0x194.7-0x194.7 (0.1) -0x0190| 00 00 00 | ... | unused1: 0 0x195-0x197.7 (3) -0x0190| 00 00 00 00 00 00 00 00| ........| offset: 0x0 0x198-0x19f.7 (8) -0x01a0|00 00 00 00 00 00 00 00 |........ | vaddr: 0x0 0x1a0-0x1a7.7 (8) -0x01a0| 00 00 00 00 00 00 00 00| ........| paddr: 0x0 0x1a8-0x1af.7 (8) -0x01b0|00 00 00 00 00 00 00 00 |........ | filesz: 0 0x1b0-0x1b7.7 (8) -0x01b0| 00 00 00 00 00 00 00 00| ........| memsz: 0 0x1b8-0x1bf.7 (8) -0x01c0|10 00 00 00 00 00 00 00 |........ | align: 16 0x1c0-0x1c7.7 (8) - | | | [1]{}: program_header 0x0-0x91b.7 (2332) + | | | [0]{}: program_header 0x0-0x91b.7 (2332) | | | program_header{}: 0x0-0x91b.7 (2332) 0x0000|7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00|.ELF............| data: raw bits 0x0-0x91b.7 (2332) * |until 0x91b.7 (2332) | | @@ -56,6 +40,22 @@ $ fq -d elf v a_static 0x00d0|1c 09 00 00 00 00 00 00 |........ | filesz: 2332 0xd0-0xd7.7 (8) 0x00d0| 1c 09 00 00 00 00 00 00| ........| memsz: 2332 0xd8-0xdf.7 (8) 0x00e0|00 00 01 00 00 00 00 00 |........ | align: 65536 0xe0-0xe7.7 (8) + | | | [1]{}: program_header 0x0-0x1c7.7 (456) + | | | program_header{}: 0x0-0x1c7.7 (456) + | | | data: raw bits 0x0-NA (0) +0x0190|51 e5 74 64 |Q.td | type: "gnu_stack" (1685382481) (GNU stack permission) 0x190-0x193.7 (4) + | | | flags{}: 0x194-0x197.7 (4) +0x0190| 06 | . | unused0: 0 0x194-0x194.4 (0.5) +0x0190| 06 | . | r: true 0x194.5-0x194.5 (0.1) +0x0190| 06 | . | w: true 0x194.6-0x194.6 (0.1) +0x0190| 06 | . | x: false 0x194.7-0x194.7 (0.1) +0x0190| 00 00 00 | ... | unused1: 0 0x195-0x197.7 (3) +0x0190| 00 00 00 00 00 00 00 00| ........| offset: 0x0 0x198-0x19f.7 (8) +0x01a0|00 00 00 00 00 00 00 00 |........ | vaddr: 0x0 0x1a0-0x1a7.7 (8) +0x01a0| 00 00 00 00 00 00 00 00| ........| paddr: 0x0 0x1a8-0x1af.7 (8) +0x01b0|00 00 00 00 00 00 00 00 |........ | filesz: 0 0x1b0-0x1b7.7 (8) +0x01b0| 00 00 00 00 00 00 00 00| ........| memsz: 0 0x1b8-0x1bf.7 (8) +0x01c0|10 00 00 00 00 00 00 00 |........ | align: 16 0x1c0-0x1c7.7 (8) | | | [2]{}: program_header 0x40-0x1ff.7 (448) | | | program_header{}: 0x40-0x1ff.7 (448) 0x0040|06 00 00 00 |.... | type: "phdr" (6) (Program header location and size) 0x40-0x43.7 (4) diff --git a/format/elf/testdata/linux_arm64/a_stripped.fqtest b/format/elf/testdata/linux_arm64/a_stripped.fqtest index 3401b961..9ced3ce9 100644 --- a/format/elf/testdata/linux_arm64/a_stripped.fqtest +++ b/format/elf/testdata/linux_arm64/a_stripped.fqtest @@ -23,23 +23,7 @@ $ fq -d elf v a_stripped 0x0030| 16 00 | .. | shnum: 22 0x3c-0x3d.7 (2) 0x0030| 15 00| ..| shstrndx: 21 0x3e-0x3f.7 (2) | | | program_headers[0:8]: 0x0-0x1007.7 (4104) - | | | [0]{}: program_header 0x0-0x1c7.7 (456) - | | | program_header{}: 0x0-0x1c7.7 (456) - | | | data: raw bits 0x0-NA (0) -0x0190|51 e5 74 64 |Q.td | type: "gnu_stack" (1685382481) (GNU stack permission) 0x190-0x193.7 (4) - | | | flags{}: 0x194-0x197.7 (4) -0x0190| 06 | . | unused0: 0 0x194-0x194.4 (0.5) -0x0190| 06 | . | r: true 0x194.5-0x194.5 (0.1) -0x0190| 06 | . | w: true 0x194.6-0x194.6 (0.1) -0x0190| 06 | . | x: false 0x194.7-0x194.7 (0.1) -0x0190| 00 00 00 | ... | unused1: 0 0x195-0x197.7 (3) -0x0190| 00 00 00 00 00 00 00 00| ........| offset: 0x0 0x198-0x19f.7 (8) -0x01a0|00 00 00 00 00 00 00 00 |........ | vaddr: 0x0 0x1a0-0x1a7.7 (8) -0x01a0| 00 00 00 00 00 00 00 00| ........| paddr: 0x0 0x1a8-0x1af.7 (8) -0x01b0|00 00 00 00 00 00 00 00 |........ | filesz: 0 0x1b0-0x1b7.7 (8) -0x01b0| 00 00 00 00 00 00 00 00| ........| memsz: 0 0x1b8-0x1bf.7 (8) -0x01c0|10 00 00 00 00 00 00 00 |........ | align: 16 0x1c0-0x1c7.7 (8) - | | | [1]{}: program_header 0x0-0x913.7 (2324) + | | | [0]{}: program_header 0x0-0x913.7 (2324) | | | program_header{}: 0x0-0x913.7 (2324) 0x0000|7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00|.ELF............| data: raw bits 0x0-0x913.7 (2324) * |until 0x913.7 (2324) | | @@ -56,6 +40,22 @@ $ fq -d elf v a_stripped 0x00d0|14 09 00 00 00 00 00 00 |........ | filesz: 2324 0xd0-0xd7.7 (8) 0x00d0| 14 09 00 00 00 00 00 00| ........| memsz: 2324 0xd8-0xdf.7 (8) 0x00e0|00 00 01 00 00 00 00 00 |........ | align: 65536 0xe0-0xe7.7 (8) + | | | [1]{}: program_header 0x0-0x1c7.7 (456) + | | | program_header{}: 0x0-0x1c7.7 (456) + | | | data: raw bits 0x0-NA (0) +0x0190|51 e5 74 64 |Q.td | type: "gnu_stack" (1685382481) (GNU stack permission) 0x190-0x193.7 (4) + | | | flags{}: 0x194-0x197.7 (4) +0x0190| 06 | . | unused0: 0 0x194-0x194.4 (0.5) +0x0190| 06 | . | r: true 0x194.5-0x194.5 (0.1) +0x0190| 06 | . | w: true 0x194.6-0x194.6 (0.1) +0x0190| 06 | . | x: false 0x194.7-0x194.7 (0.1) +0x0190| 00 00 00 | ... | unused1: 0 0x195-0x197.7 (3) +0x0190| 00 00 00 00 00 00 00 00| ........| offset: 0x0 0x198-0x19f.7 (8) +0x01a0|00 00 00 00 00 00 00 00 |........ | vaddr: 0x0 0x1a0-0x1a7.7 (8) +0x01a0| 00 00 00 00 00 00 00 00| ........| paddr: 0x0 0x1a8-0x1af.7 (8) +0x01b0|00 00 00 00 00 00 00 00 |........ | filesz: 0 0x1b0-0x1b7.7 (8) +0x01b0| 00 00 00 00 00 00 00 00| ........| memsz: 0 0x1b8-0x1bf.7 (8) +0x01c0|10 00 00 00 00 00 00 00 |........ | align: 16 0x1c0-0x1c7.7 (8) | | | [2]{}: program_header 0x40-0x1ff.7 (448) | | | program_header{}: 0x40-0x1ff.7 (448) 0x0040|06 00 00 00 |.... | type: "phdr" (6) (Program header location and size) 0x40-0x43.7 (4) diff --git a/format/elf/testdata/linux_arm64/libbbb.a.fqtest b/format/elf/testdata/linux_arm64/libbbb.a.fqtest index c553e20b..3c46a5cb 100644 --- a/format/elf/testdata/linux_arm64/libbbb.a.fqtest +++ b/format/elf/testdata/linux_arm64/libbbb.a.fqtest @@ -113,36 +113,7 @@ $ fq -d ar v libbbb.a 0x410| 04 00 00 00 00 00 00 00 | ........ | addralign: 4 0x414-0x41b.7 (8) 0x410| 00 00 00 00| ....| entsize: 0 0x41c-0x423.7 (8) 0x420|00 00 00 00 |.... | - | | | [2]{}: section_header 0xf4-0x523.7 (1072) -0x0f0| 6c 69 62 62 62 62 5f 62 62 62 00 | libbbb_bbb. | data: raw bits 0xf4-0xfe.7 (11) -0x4e0| 31 00 00 00 | 1... | name: ".rodata" (49) 0x4e4-0x4e7.7 (4) -0x4e0| 01 00 00 00 | .... | type: "progbits" (0x1) (Information defined by the program) 0x4e8-0x4eb.7 (4) - | | | flags{}: 0x4ec-0x4f3.7 (8) -0x4e0| 02 | . | link_order: false 0x4ec-0x4ec (0.1) -0x4e0| 02 | . | info_link: false 0x4ec.1-0x4ec.1 (0.1) -0x4e0| 02 | . | strings: false 0x4ec.2-0x4ec.2 (0.1) -0x4e0| 02 | . | merge: false 0x4ec.3-0x4ec.3 (0.1) -0x4e0| 02 | . | unused0: 0 0x4ec.4-0x4ec.4 (0.1) -0x4e0| 02 | . | execinstr: false 0x4ec.5-0x4ec.5 (0.1) -0x4e0| 02 | . | alloc: true 0x4ec.6-0x4ec.6 (0.1) -0x4e0| 02 | . | write: false 0x4ec.7-0x4ec.7 (0.1) -0x4e0| 00 | . | tls: false 0x4ed-0x4ed (0.1) -0x4e0| 00 | . | group: false 0x4ed.1-0x4ed.1 (0.1) -0x4e0| 00 | . | os_nonconforming: false 0x4ed.2-0x4ed.2 (0.1) -0x4e0| 00 00 | .. | unused1: 0 0x4ed.3-0x4ee.3 (1.1) -0x4e0| 00 00| ..| os_specific: 0 0x4ee.4-0x4ef.3 (1) -0x4e0| 00| .| processor_specific: 0 0x4ef.4-0x4ef.7 (0.4) -0x4f0|00 00 00 00 |.... | unused2: 0 0x4f0-0x4f3.7 (4) -0x4f0| 00 00 00 00 00 00 00 00 | ........ | addr: 0x0 0x4f4-0x4fb.7 (8) -0x4f0| 60 00 00 00| `...| offset: 0x60 0x4fc-0x503.7 (8) -0x500|00 00 00 00 |.... | -0x500| 0b 00 00 00 00 00 00 00 | ........ | size: 11 0x504-0x50b.7 (8) -0x500| 00 00 00 00| ....| link: 0 0x50c-0x50f.7 (4) -0x510|00 00 00 00 |.... | info: 0 0x510-0x513.7 (4) -0x510| 08 00 00 00 00 00 00 00 | ........ | addralign: 8 0x514-0x51b.7 (8) -0x510| 00 00 00 00| ....| entsize: 0 0x51c-0x523.7 (8) -0x520|00 00 00 00 |.... | - | | | [3]{}: section_header 0xf4-0x4a3.7 (944) + | | | [2]{}: section_header 0xf4-0x4a3.7 (944) | | | data: raw bits 0xf4-NA (0) 0x460| 26 00 00 00 | &... | name: ".data" (38) 0x464-0x467.7 (4) 0x460| 01 00 00 00 | .... | type: "progbits" (0x1) (Information defined by the program) 0x468-0x46b.7 (4) @@ -171,6 +142,35 @@ $ fq -d ar v libbbb.a 0x490| 01 00 00 00 00 00 00 00 | ........ | addralign: 1 0x494-0x49b.7 (8) 0x490| 00 00 00 00| ....| entsize: 0 0x49c-0x4a3.7 (8) 0x4a0|00 00 00 00 |.... | + | | | [3]{}: section_header 0xf4-0x523.7 (1072) +0x0f0| 6c 69 62 62 62 62 5f 62 62 62 00 | libbbb_bbb. | data: raw bits 0xf4-0xfe.7 (11) +0x4e0| 31 00 00 00 | 1... | name: ".rodata" (49) 0x4e4-0x4e7.7 (4) +0x4e0| 01 00 00 00 | .... | type: "progbits" (0x1) (Information defined by the program) 0x4e8-0x4eb.7 (4) + | | | flags{}: 0x4ec-0x4f3.7 (8) +0x4e0| 02 | . | link_order: false 0x4ec-0x4ec (0.1) +0x4e0| 02 | . | info_link: false 0x4ec.1-0x4ec.1 (0.1) +0x4e0| 02 | . | strings: false 0x4ec.2-0x4ec.2 (0.1) +0x4e0| 02 | . | merge: false 0x4ec.3-0x4ec.3 (0.1) +0x4e0| 02 | . | unused0: 0 0x4ec.4-0x4ec.4 (0.1) +0x4e0| 02 | . | execinstr: false 0x4ec.5-0x4ec.5 (0.1) +0x4e0| 02 | . | alloc: true 0x4ec.6-0x4ec.6 (0.1) +0x4e0| 02 | . | write: false 0x4ec.7-0x4ec.7 (0.1) +0x4e0| 00 | . | tls: false 0x4ed-0x4ed (0.1) +0x4e0| 00 | . | group: false 0x4ed.1-0x4ed.1 (0.1) +0x4e0| 00 | . | os_nonconforming: false 0x4ed.2-0x4ed.2 (0.1) +0x4e0| 00 00 | .. | unused1: 0 0x4ed.3-0x4ee.3 (1.1) +0x4e0| 00 00| ..| os_specific: 0 0x4ee.4-0x4ef.3 (1) +0x4e0| 00| .| processor_specific: 0 0x4ef.4-0x4ef.7 (0.4) +0x4f0|00 00 00 00 |.... | unused2: 0 0x4f0-0x4f3.7 (4) +0x4f0| 00 00 00 00 00 00 00 00 | ........ | addr: 0x0 0x4f4-0x4fb.7 (8) +0x4f0| 60 00 00 00| `...| offset: 0x60 0x4fc-0x503.7 (8) +0x500|00 00 00 00 |.... | +0x500| 0b 00 00 00 00 00 00 00 | ........ | size: 11 0x504-0x50b.7 (8) +0x500| 00 00 00 00| ....| link: 0 0x50c-0x50f.7 (4) +0x510|00 00 00 00 |.... | info: 0 0x510-0x513.7 (4) +0x510| 08 00 00 00 00 00 00 00 | ........ | addralign: 8 0x514-0x51b.7 (8) +0x510| 00 00 00 00| ....| entsize: 0 0x51c-0x523.7 (8) +0x520|00 00 00 00 |.... | | | | [4]{}: section_header 0xff-0x563.7 (1125) 0x0f0| 00| .| data: raw bits 0xff-0x130.7 (50) 0x100|47 43 43 3a 20 28 41 6c 70 69 6e 65 20 31 30 2e|GCC: (Alpine 10.| diff --git a/format/elf/testdata/linux_arm_v6/libbbb.a.fqtest b/format/elf/testdata/linux_arm_v6/libbbb.a.fqtest index 686c9fcb..65761a7d 100644 --- a/format/elf/testdata/linux_arm_v6/libbbb.a.fqtest +++ b/format/elf/testdata/linux_arm_v6/libbbb.a.fqtest @@ -186,7 +186,33 @@ $ fq -d ar v libbbb.a 0x3d0| 00 00 00 00| ....| info: 0 0x3dc-0x3df.7 (4) 0x3e0|01 00 00 00 |.... | addralign: 1 0x3e0-0x3e3.7 (4) 0x3e0| 01 00 00 00 | .... | entsize: 1 0x3e4-0x3e7.7 (4) - | | | [5]{}: section_header 0x129-0x437.7 (783) + | | | [5]{}: section_header 0x129-0x40f.7 (743) + | | | data: raw bits 0x129-NA (0) +0x3e0| 41 00 00 00 | A... | name: ".note.GNU-stack" (65) 0x3e8-0x3eb.7 (4) +0x3e0| 01 00 00 00| ....| type: "progbits" (0x1) (Information defined by the program) 0x3ec-0x3ef.7 (4) + | | | flags{}: 0x3f0-0x3f3.7 (4) +0x3f0|00 |. | link_order: false 0x3f0-0x3f0 (0.1) +0x3f0|00 |. | info_link: false 0x3f0.1-0x3f0.1 (0.1) +0x3f0|00 |. | strings: false 0x3f0.2-0x3f0.2 (0.1) +0x3f0|00 |. | merge: false 0x3f0.3-0x3f0.3 (0.1) +0x3f0|00 |. | unused0: 0 0x3f0.4-0x3f0.4 (0.1) +0x3f0|00 |. | execinstr: false 0x3f0.5-0x3f0.5 (0.1) +0x3f0|00 |. | alloc: false 0x3f0.6-0x3f0.6 (0.1) +0x3f0|00 |. | write: false 0x3f0.7-0x3f0.7 (0.1) +0x3f0| 00 | . | tls: false 0x3f1-0x3f1 (0.1) +0x3f0| 00 | . | group: false 0x3f1.1-0x3f1.1 (0.1) +0x3f0| 00 | . | os_nonconforming: false 0x3f1.2-0x3f1.2 (0.1) +0x3f0| 00 00 | .. | unused1: 0 0x3f1.3-0x3f2.3 (1.1) +0x3f0| 00 00 | .. | os_specific: 0 0x3f2.4-0x3f3.3 (1) +0x3f0| 00 | . | processor_specific: 0 0x3f3.4-0x3f3.7 (0.4) +0x3f0| 00 00 00 00 | .... | addr: 0x0 0x3f4-0x3f7.7 (4) +0x3f0| 95 00 00 00 | .... | offset: 149 0x3f8-0x3fb.7 (4) +0x3f0| 00 00 00 00| ....| size: 0x0 0x3fc-0x3ff.7 (4) +0x400|00 00 00 00 |.... | link: 0 0x400-0x403.7 (4) +0x400| 00 00 00 00 | .... | info: 0 0x404-0x407.7 (4) +0x400| 01 00 00 00 | .... | addralign: 1 0x408-0x40b.7 (4) +0x400| 00 00 00 00| ....| entsize: 0 0x40c-0x40f.7 (4) + | | | [6]{}: section_header 0x129-0x437.7 (783) 0x120| 41 32 00 00 00 61 65| A2...ae| data: raw bits 0x129-0x15b.7 (51) 0x130|61 62 69 00 01 28 00 00 00 05 36 5a 4b 00 06 07|abi..(....6ZK...| * |until 0x15b.7 (51) | | @@ -214,32 +240,6 @@ $ fq -d ar v libbbb.a 0x420| 00 00 00 00| ....| info: 0 0x42c-0x42f.7 (4) 0x430|01 00 00 00 |.... | addralign: 1 0x430-0x433.7 (4) 0x430| 00 00 00 00 | .... | entsize: 0 0x434-0x437.7 (4) - | | | [6]{}: section_header 0x129-0x40f.7 (743) - | | | data: raw bits 0x129-NA (0) -0x3e0| 41 00 00 00 | A... | name: ".note.GNU-stack" (65) 0x3e8-0x3eb.7 (4) -0x3e0| 01 00 00 00| ....| type: "progbits" (0x1) (Information defined by the program) 0x3ec-0x3ef.7 (4) - | | | flags{}: 0x3f0-0x3f3.7 (4) -0x3f0|00 |. | link_order: false 0x3f0-0x3f0 (0.1) -0x3f0|00 |. | info_link: false 0x3f0.1-0x3f0.1 (0.1) -0x3f0|00 |. | strings: false 0x3f0.2-0x3f0.2 (0.1) -0x3f0|00 |. | merge: false 0x3f0.3-0x3f0.3 (0.1) -0x3f0|00 |. | unused0: 0 0x3f0.4-0x3f0.4 (0.1) -0x3f0|00 |. | execinstr: false 0x3f0.5-0x3f0.5 (0.1) -0x3f0|00 |. | alloc: false 0x3f0.6-0x3f0.6 (0.1) -0x3f0|00 |. | write: false 0x3f0.7-0x3f0.7 (0.1) -0x3f0| 00 | . | tls: false 0x3f1-0x3f1 (0.1) -0x3f0| 00 | . | group: false 0x3f1.1-0x3f1.1 (0.1) -0x3f0| 00 | . | os_nonconforming: false 0x3f1.2-0x3f1.2 (0.1) -0x3f0| 00 00 | .. | unused1: 0 0x3f1.3-0x3f2.3 (1.1) -0x3f0| 00 00 | .. | os_specific: 0 0x3f2.4-0x3f3.3 (1) -0x3f0| 00 | . | processor_specific: 0 0x3f3.4-0x3f3.7 (0.4) -0x3f0| 00 00 00 00 | .... | addr: 0x0 0x3f4-0x3f7.7 (4) -0x3f0| 95 00 00 00 | .... | offset: 149 0x3f8-0x3fb.7 (4) -0x3f0| 00 00 00 00| ....| size: 0x0 0x3fc-0x3ff.7 (4) -0x400|00 00 00 00 |.... | link: 0 0x400-0x403.7 (4) -0x400| 00 00 00 00 | .... | info: 0 0x404-0x407.7 (4) -0x400| 01 00 00 00 | .... | addralign: 1 0x408-0x40b.7 (4) -0x400| 00 00 00 00| ....| entsize: 0 0x40c-0x40f.7 (4) | | | [7]{}: section_header 0x15c-0x45f.7 (772) | | | symbol_table[0:14]: 0x15c-0x23b.7 (224) | | | [0]{}: symbol 0x15c-0x16b.7 (16) diff --git a/format/elf/testdata/linux_arm_v7/libbbb.a.fqtest b/format/elf/testdata/linux_arm_v7/libbbb.a.fqtest index 686c9fcb..65761a7d 100644 --- a/format/elf/testdata/linux_arm_v7/libbbb.a.fqtest +++ b/format/elf/testdata/linux_arm_v7/libbbb.a.fqtest @@ -186,7 +186,33 @@ $ fq -d ar v libbbb.a 0x3d0| 00 00 00 00| ....| info: 0 0x3dc-0x3df.7 (4) 0x3e0|01 00 00 00 |.... | addralign: 1 0x3e0-0x3e3.7 (4) 0x3e0| 01 00 00 00 | .... | entsize: 1 0x3e4-0x3e7.7 (4) - | | | [5]{}: section_header 0x129-0x437.7 (783) + | | | [5]{}: section_header 0x129-0x40f.7 (743) + | | | data: raw bits 0x129-NA (0) +0x3e0| 41 00 00 00 | A... | name: ".note.GNU-stack" (65) 0x3e8-0x3eb.7 (4) +0x3e0| 01 00 00 00| ....| type: "progbits" (0x1) (Information defined by the program) 0x3ec-0x3ef.7 (4) + | | | flags{}: 0x3f0-0x3f3.7 (4) +0x3f0|00 |. | link_order: false 0x3f0-0x3f0 (0.1) +0x3f0|00 |. | info_link: false 0x3f0.1-0x3f0.1 (0.1) +0x3f0|00 |. | strings: false 0x3f0.2-0x3f0.2 (0.1) +0x3f0|00 |. | merge: false 0x3f0.3-0x3f0.3 (0.1) +0x3f0|00 |. | unused0: 0 0x3f0.4-0x3f0.4 (0.1) +0x3f0|00 |. | execinstr: false 0x3f0.5-0x3f0.5 (0.1) +0x3f0|00 |. | alloc: false 0x3f0.6-0x3f0.6 (0.1) +0x3f0|00 |. | write: false 0x3f0.7-0x3f0.7 (0.1) +0x3f0| 00 | . | tls: false 0x3f1-0x3f1 (0.1) +0x3f0| 00 | . | group: false 0x3f1.1-0x3f1.1 (0.1) +0x3f0| 00 | . | os_nonconforming: false 0x3f1.2-0x3f1.2 (0.1) +0x3f0| 00 00 | .. | unused1: 0 0x3f1.3-0x3f2.3 (1.1) +0x3f0| 00 00 | .. | os_specific: 0 0x3f2.4-0x3f3.3 (1) +0x3f0| 00 | . | processor_specific: 0 0x3f3.4-0x3f3.7 (0.4) +0x3f0| 00 00 00 00 | .... | addr: 0x0 0x3f4-0x3f7.7 (4) +0x3f0| 95 00 00 00 | .... | offset: 149 0x3f8-0x3fb.7 (4) +0x3f0| 00 00 00 00| ....| size: 0x0 0x3fc-0x3ff.7 (4) +0x400|00 00 00 00 |.... | link: 0 0x400-0x403.7 (4) +0x400| 00 00 00 00 | .... | info: 0 0x404-0x407.7 (4) +0x400| 01 00 00 00 | .... | addralign: 1 0x408-0x40b.7 (4) +0x400| 00 00 00 00| ....| entsize: 0 0x40c-0x40f.7 (4) + | | | [6]{}: section_header 0x129-0x437.7 (783) 0x120| 41 32 00 00 00 61 65| A2...ae| data: raw bits 0x129-0x15b.7 (51) 0x130|61 62 69 00 01 28 00 00 00 05 36 5a 4b 00 06 07|abi..(....6ZK...| * |until 0x15b.7 (51) | | @@ -214,32 +240,6 @@ $ fq -d ar v libbbb.a 0x420| 00 00 00 00| ....| info: 0 0x42c-0x42f.7 (4) 0x430|01 00 00 00 |.... | addralign: 1 0x430-0x433.7 (4) 0x430| 00 00 00 00 | .... | entsize: 0 0x434-0x437.7 (4) - | | | [6]{}: section_header 0x129-0x40f.7 (743) - | | | data: raw bits 0x129-NA (0) -0x3e0| 41 00 00 00 | A... | name: ".note.GNU-stack" (65) 0x3e8-0x3eb.7 (4) -0x3e0| 01 00 00 00| ....| type: "progbits" (0x1) (Information defined by the program) 0x3ec-0x3ef.7 (4) - | | | flags{}: 0x3f0-0x3f3.7 (4) -0x3f0|00 |. | link_order: false 0x3f0-0x3f0 (0.1) -0x3f0|00 |. | info_link: false 0x3f0.1-0x3f0.1 (0.1) -0x3f0|00 |. | strings: false 0x3f0.2-0x3f0.2 (0.1) -0x3f0|00 |. | merge: false 0x3f0.3-0x3f0.3 (0.1) -0x3f0|00 |. | unused0: 0 0x3f0.4-0x3f0.4 (0.1) -0x3f0|00 |. | execinstr: false 0x3f0.5-0x3f0.5 (0.1) -0x3f0|00 |. | alloc: false 0x3f0.6-0x3f0.6 (0.1) -0x3f0|00 |. | write: false 0x3f0.7-0x3f0.7 (0.1) -0x3f0| 00 | . | tls: false 0x3f1-0x3f1 (0.1) -0x3f0| 00 | . | group: false 0x3f1.1-0x3f1.1 (0.1) -0x3f0| 00 | . | os_nonconforming: false 0x3f1.2-0x3f1.2 (0.1) -0x3f0| 00 00 | .. | unused1: 0 0x3f1.3-0x3f2.3 (1.1) -0x3f0| 00 00 | .. | os_specific: 0 0x3f2.4-0x3f3.3 (1) -0x3f0| 00 | . | processor_specific: 0 0x3f3.4-0x3f3.7 (0.4) -0x3f0| 00 00 00 00 | .... | addr: 0x0 0x3f4-0x3f7.7 (4) -0x3f0| 95 00 00 00 | .... | offset: 149 0x3f8-0x3fb.7 (4) -0x3f0| 00 00 00 00| ....| size: 0x0 0x3fc-0x3ff.7 (4) -0x400|00 00 00 00 |.... | link: 0 0x400-0x403.7 (4) -0x400| 00 00 00 00 | .... | info: 0 0x404-0x407.7 (4) -0x400| 01 00 00 00 | .... | addralign: 1 0x408-0x40b.7 (4) -0x400| 00 00 00 00| ....| entsize: 0 0x40c-0x40f.7 (4) | | | [7]{}: section_header 0x15c-0x45f.7 (772) | | | symbol_table[0:14]: 0x15c-0x23b.7 (224) | | | [0]{}: symbol 0x15c-0x16b.7 (16) diff --git a/pkg/decode/value.go b/pkg/decode/value.go index 6689e486..4ca7c052 100644 --- a/pkg/decode/value.go +++ b/pkg/decode/value.go @@ -202,8 +202,9 @@ func (v *Value) postProcess() { } } - // TODO: really sort array? - sort.Slice(vv.Children, func(i, j int) bool { + // TODO: really sort array? if sort it needs to be stable to keep the order + // of value with same range start, think null values etc + sort.SliceStable(vv.Children, func(i, j int) bool { return (vv.Children)[i].Range.Start < (vv.Children)[j].Range.Start })