Skip to content

Commit

Permalink
Merge pull request #90 from wader/decode-stable-sort
Browse files Browse the repository at this point in the history
decode: Use stable sort for values to not change order or values with…
  • Loading branch information
wader authored Jan 20, 2022
2 parents 3201314 + cf8a50c commit 34a09c4
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 198 deletions.
60 changes: 30 additions & 30 deletions format/elf/testdata/linux_386/libbbb.a.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -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 |.. |
Expand Down Expand Up @@ -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)
Expand Down
62 changes: 31 additions & 31 deletions format/elf/testdata/linux_amd64/libbbb.a.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -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) | |
Expand Down Expand Up @@ -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..............|
Expand Down
Loading

0 comments on commit 34a09c4

Please sign in to comment.