1 ## Check how obj2yaml dumps SHT_NOTE sections.
3 ## We can dump the Name, Desc and Type fields when the note section is valid.
5 # RUN: yaml2obj --docnum=1 %s -o %t1
6 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=VALID
8 # VALID: - Name: .note.foo
9 # VALID-NEXT: Type: SHT_NOTE
11 # VALID-NEXT: - Name: ''
12 # VALID-NEXT: Desc: ''
13 # VALID-NEXT: Type: 0x0
14 # VALID-NEXT: - Name: .note.bar
15 # VALID-NEXT: Type: SHT_NOTE
17 # VALID-NEXT: - Name: ABC
18 # VALID-NEXT: Desc: '001122'
19 # VALID-NEXT: Type: 0xAABBCCDD
37 ## Check we dump hex digit pairs if the note section is invalid.
39 # RUN: yaml2obj --docnum=2 %s -o %t2
40 # RUN: obj2yaml %t2 | FileCheck %s --check-prefix=INVALID
42 # INVALID: - Name: .note.tooShortNote
43 # INVALID-NEXT: Type: SHT_NOTE
44 # INVALID-NEXT: Content: '0000000000000000000000'
45 # INVALID-NEXT: - Name: .note.tooLongNameSize
46 # INVALID-NEXT: Type: SHT_NOTE
47 # INVALID-NEXT: Content: 0100000000000000FF00000000
48 # INVALID-NEXT: - Name: .note.tooLongDescSize
49 # INVALID-NEXT: Type: SHT_NOTE
50 # INVALID-NEXT: Content: 0000000001000000FF00000000
58 ## Content is less than 12 bytes in size.
59 ## (12 is the size of n_namesz, n_descsz and n_type 4-bytes fields that must always present).
60 - Name: .note.tooShortNote
63 ## We can't dump the Name, Desc and Type fields when the
64 ## content is shorter than the computed size.
66 ## Too long name size.
67 - Name: .note.tooLongNameSize
69 Content: "0100000000000000ff00000000"
70 ## Too long description size.
71 - Name: .note.tooLongDescSize
73 Content: "0000000001000000ff00000000"
75 ## Check we do not crash when dumping a description that has bytes
76 ## on its bounds that do not fit into signed byte.
77 ## This is a completely normal case, but we had a crash before.
79 # RUN: yaml2obj --docnum=3 %s -o %t3
80 # RUN: obj2yaml %t3 | FileCheck %s --check-prefix=HEX-DESC
82 # HEX-DESC: Desc: FE0000FE