1 ## Test tools are able to dump different types of notes.
3 # RUN: yaml2obj --docnum=1 %s > %t1.so
4 # RUN: llvm-readelf --notes %t1.so | FileCheck %s --check-prefix=GNU
5 # RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM
7 # GNU: Displaying notes found at file offset 0x00000200 with length 0x00000020:
8 # GNU-NEXT: Owner Data size Description
9 # GNU-NEXT: GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
10 # GNU-NEXT: OS: Linux, ABI: 2.6.32
12 # GNU: Displaying notes found at file offset 0x00000220 with length 0x00000020:
13 # GNU-NEXT: Owner Data size Description
14 # GNU-NEXT: GNU 0x00000010 NT_GNU_BUILD_ID (unique build ID bitstring)
15 # GNU-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
17 # GNU: Displaying notes found at file offset 0x00000240 with length 0x0000001c:
18 # GNU-NEXT: Owner Data size Description
19 # GNU-NEXT: GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version)
20 # GNU-NEXT: Version: gold 1.11
23 # LLVM-NEXT: NoteSection {
24 # LLVM-NEXT: Offset: 0x200
25 # LLVM-NEXT: Size: 0x20
27 # LLVM-NEXT: Owner: GNU
28 # LLVM-NEXT: Data size: 0x10
29 # LLVM-NEXT: Type: NT_GNU_ABI_TAG (ABI version tag)
30 # LLVM-NEXT: OS: Linux
31 # LLVM-NEXT: ABI: 2.6.32
34 # LLVM-NEXT: NoteSection {
35 # LLVM-NEXT: Offset: 0x220
36 # LLVM-NEXT: Size: 0x20
38 # LLVM-NEXT: Owner: GNU
39 # LLVM-NEXT: Data size: 0x10
40 # LLVM-NEXT: Type: NT_GNU_BUILD_ID (unique build ID bitstring)
41 # LLVM-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
44 # LLVM-NEXT: NoteSection {
45 # LLVM-NEXT: Offset: 0x240
46 # LLVM-NEXT: Size: 0x1C
48 # LLVM-NEXT: Owner: GNU
49 # LLVM-NEXT: Data size: 0x9
50 # LLVM-NEXT: Type: NT_GNU_GOLD_VERSION (gold version)
51 # LLVM-NEXT: Version: gold 1.11
65 AddressAlign: 0x0000000000000004
66 Content: 040000001000000001000000474E550000000000020000000600000020000000
67 - Name: .note.gnu.build-id
70 Address: 0x0000000000400120
71 AddressAlign: 0x0000000000000004
72 Content: 040000001000000003000000474E55004FCB712AA6387724A9F465A32CD8C14B
73 - Name: .note.gnu.gold-version
75 AddressAlign: 0x0000000000000004
76 Content: 040000000900000004000000474E5500676F6C6420312E3131000000
78 ## Test tools report an error if a note section has an invalid offset
79 ## that goes past the end of file.
81 # RUN: yaml2obj --docnum=2 %s > %t2.so
82 # RUN: not llvm-readelf --notes %t2.so 2>&1 | FileCheck %s --check-prefix=ERR1
83 # RUN: not llvm-readobj --notes %t2.so 2>&1 | FileCheck %s --check-prefix=ERR1
85 # ERR1: error: SHT_NOTE section [index 1] has invalid offset (0xffff0000) or size (0x0)
98 ## Test tools report an error if a note section has invalid size
99 ## that goes past the end of file.
101 # RUN: yaml2obj --docnum=3 %s > %t3.so
102 # RUN: not llvm-readelf --notes %t3.so 2>&1 | FileCheck %s --check-prefix=ERR2
103 # RUN: not llvm-readobj --notes %t3.so 2>&1 | FileCheck %s --check-prefix=ERR2
105 # ERR2: error: SHT_NOTE section [index 1] has invalid offset (0x180) or size (0xffff0000)
118 ## Test tools report an error if a note program header has an invalid offset that
119 ## goes past the end of file.
121 # RUN: yaml2obj --docnum=4 %s > %t4.so
122 # RUN: not llvm-readelf --notes %t4.so 2>&1 | FileCheck %s --check-prefix=ERR3
123 # RUN: not llvm-readobj --notes %t4.so 2>&1 | FileCheck %s --check-prefix=ERR3
125 # ERR3: error: PT_NOTE header has invalid offset (0xffff0000) or size (0x0)
142 ## Test tools report an error if a note program header has an invalid size that
143 ## goes past the end of file.
145 # RUN: yaml2obj --docnum=5 %s > %t5.so
146 # RUN: not llvm-readelf --notes %t5.so 2>&1 | FileCheck %s --check-prefix=ERR4
147 # RUN: not llvm-readobj --notes %t5.so 2>&1 | FileCheck %s --check-prefix=ERR4
149 # ERR4: error: PT_NOTE header has invalid offset (0x1b8) or size (0xffff0000)