1 ## Check how obj2yaml produces SHT_HASH section descriptions.
3 ## Check that obj2yaml uses "Bucket" and "Chain" tags to describe
4 ## a SHT_HASH section when it has content of a correct size.
5 ## I.e. data size == 4 * (2 + nbucket + nchain).
7 # RUN: yaml2obj --docnum=1 %s -o %t1
8 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=CHAIN-BUCKET
10 # CHAIN-BUCKET: - Name: .hash1
11 # CHAIN-BUCKET-NEXT: Type: SHT_HASH
12 # CHAIN-BUCKET-NEXT: Bucket: [ 3 ]
13 # CHAIN-BUCKET-NEXT: Chain: [ 4, 5 ]
14 # CHAIN-BUCKET: - Name: .hash2
15 # CHAIN-BUCKET-NEXT: Type: SHT_HASH
16 # CHAIN-BUCKET-NEXT: Bucket: [ ]
17 # CHAIN-BUCKET-NEXT: Chain: [ ]
25 ## Case 1: A non-empty hash table: nbucket == 1, nchain == 2.
28 Content: '0100000002000000030000000400000005000000'
29 ## Case 2: An empty hash table: nbucket == 0, nchain == 0.
32 Content: '0000000000000000'
34 ## Check that obj2yaml falls back to using the "Content" tag when
35 ## hash sections are broken.
37 # RUN: yaml2obj --docnum=2 %s -o %t2
38 # RUN: obj2yaml %t2 | FileCheck %s --check-prefix=CONTENT
40 # CONTENT: - Name: .empty_hash
41 # CONTENT-NEXT: Type: SHT_HASH
42 # CONTENT-NEXT: Content: ''
43 # CONTENT-NEXT: - Name: .invalid_header
44 # CONTENT-NEXT: Type: SHT_HASH
45 # CONTENT-NEXT: Content: '00'
46 # CONTENT-NEXT: - Name: .truncated
47 # CONTENT-NEXT: Type: SHT_HASH
48 # CONTENT-NEXT: Content: '01000000020000000300000004000000'
49 # CONTENT-NEXT: - Name: .oversized
50 # CONTENT-NEXT: Type: SHT_HASH
51 # CONTENT-NEXT: Content: '0100000002000000030000000400000000'
52 # CONTENT-NEXT: - Name: .overflow1
53 # CONTENT-NEXT: Type: SHT_HASH
54 # CONTENT-NEXT: Content: 01000000FFFFFFFF{{$}}
55 # CONTENT-NEXT: - Name: .overflow2
56 # CONTENT-NEXT: Type: SHT_HASH
57 # CONTENT-NEXT: Content: FFFFFFFF01000000{{$}}
66 ## Case 1: section has no data.
70 ## Case 2: section size is less than 2 * 4.
71 - Name: .invalid_header
74 ## Case 3: nbucket == 1, nchain == 2.
75 ## Section size is less than (2 * nbucket + nchain) * 4.
78 Content: '01000000020000000300000004000000'
79 ## Case 4: nbucket == 1, nchain == 2.
80 ## Section size is greater than (2 * nbucket + nchain) * 4.
83 Content: '0100000002000000030000000400000000'
84 ## Case 5, 6: NChain/NBucket are incorrect and causing 32-bit
85 ## unsigned overflows of intermediate expressions.
99 ## Check how we dump the "EntSize" field. When the sh_entsize is 4,
100 ## we don't print it, because it is the default value for the SHT_HASH section.
102 # RUN: yaml2obj --docnum=3 %s -o %t3
103 # RUN: obj2yaml %t3 | FileCheck %s --check-prefix=ENT-SIZE
105 # ENT-SIZE: - Name: .hash.entsize.0
106 # ENT-SIZE-NEXT: Type: SHT_HASH
107 # ENT-SIZE-NEXT: EntSize: 0x0
108 # ENT-SIZE-NEXT: Content: ''
109 # ENT-SIZE-NEXT: - Name: .hash.entsize.4.default
110 # ENT-SIZE-NEXT: Type: SHT_HASH
111 # ENT-SIZE-NEXT: Content: ''
112 # ENT-SIZE-NEXT: - Name: .hash.entsize.255
113 # ENT-SIZE-NEXT: Type: SHT_HASH
114 # ENT-SIZE-NEXT: EntSize: 0xFF
115 # ENT-SIZE-NEXT: Content: ''
123 - Name: .hash.entsize.0
127 - Name: .hash.entsize.4.default
131 - Name: .hash.entsize.255