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 --strict-whitespace --match-full-lines
5 # RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM
6 # RUN: llvm-objcopy --strip-sections %t1.so %t1.stripped.so
7 # RUN: llvm-readelf --notes %t1.stripped.so | FileCheck %s --check-prefix=GNU-STRIPPED --strict-whitespace --match-full-lines
8 # RUN: llvm-readobj --notes %t1.stripped.so | FileCheck %s --check-prefix=LLVM-STRIPPED
10 # GNU:Displaying notes found at file offset 0x00000078 with length 0x00000020:
11 # GNU-NEXT: Owner Data size Description
12 # GNU-NEXT: GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
13 # GNU-NEXT: OS: Linux, ABI: 2.6.32
15 # GNU:Displaying notes found at file offset 0x00000098 with length 0x00000020:
16 # GNU-NEXT: Owner Data size Description
17 # GNU-NEXT: GNU 0x00000010 NT_GNU_BUILD_ID (unique build ID bitstring)
18 # GNU-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
20 # GNU:Displaying notes found at file offset 0x000000b8 with length 0x0000001c:
21 # GNU-NEXT: Owner Data size Description
22 # GNU-NEXT: GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version)
23 # GNU-NEXT: Version: gold 1.11
26 # LLVM-NEXT: NoteSection {
27 # LLVM-NEXT: Offset: 0x78
28 # LLVM-NEXT: Size: 0x20
30 # LLVM-NEXT: Owner: GNU
31 # LLVM-NEXT: Data size: 0x10
32 # LLVM-NEXT: Type: NT_GNU_ABI_TAG (ABI version tag)
33 # LLVM-NEXT: OS: Linux
34 # LLVM-NEXT: ABI: 2.6.32
37 # LLVM-NEXT: NoteSection {
38 # LLVM-NEXT: Offset: 0x98
39 # LLVM-NEXT: Size: 0x20
41 # LLVM-NEXT: Owner: GNU
42 # LLVM-NEXT: Data size: 0x10
43 # LLVM-NEXT: Type: NT_GNU_BUILD_ID (unique build ID bitstring)
44 # LLVM-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
47 # LLVM-NEXT: NoteSection {
48 # LLVM-NEXT: Offset: 0xB8
49 # LLVM-NEXT: Size: 0x1C
51 # LLVM-NEXT: Owner: GNU
52 # LLVM-NEXT: Data size: 0x9
53 # LLVM-NEXT: Type: NT_GNU_GOLD_VERSION (gold version)
54 # LLVM-NEXT: Version: gold 1.11
59 # LLVM-STRIPPED: Notes [
60 # LLVM-STRIPPED-NEXT: NoteSection {
61 # LLVM-STRIPPED-NEXT: Offset: 0x78
62 # LLVM-STRIPPED-NEXT: Size: 0x20
63 # LLVM-STRIPPED-NEXT: Note {
64 # LLVM-STRIPPED-NEXT: Owner: GNU
65 # LLVM-STRIPPED-NEXT: Data size: 0x10
66 # LLVM-STRIPPED-NEXT: Type: NT_GNU_BUILD_ID (unique build ID bitstring)
67 # LLVM-STRIPPED-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
68 # LLVM-STRIPPED-NEXT: }
69 # LLVM-STRIPPED-NEXT: }
70 # LLVM-STRIPPED-NEXT: ]
72 # GNU-STRIPPED:Displaying notes found at file offset 0x00000078 with length 0x00000020:
73 # GNU-STRIPPED-NEXT: Owner Data size Description
74 # GNU-STRIPPED-NEXT: GNU 0x00000010 NT_GNU_BUILD_ID (unique build ID bitstring)
75 # GNU-STRIPPED-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
86 AddressAlign: 0x0000000000000004
87 Content: 040000001000000001000000474E550000000000020000000600000020000000
88 - Name: .note.gnu.build-id
91 Address: 0x0000000000400120
92 AddressAlign: 0x0000000000000004
93 Content: 040000001000000003000000474E55004FCB712AA6387724A9F465A32CD8C14B
94 - Name: .note.gnu.gold-version
96 AddressAlign: 0x0000000000000004
97 Content: 040000000900000004000000474E5500676F6C6420312E3131000000
102 - Section: .note.gnu.build-id
104 ## Test tools report an error if a note section has an invalid offset
105 ## that goes past the end of file.
107 # RUN: yaml2obj --docnum=2 %s > %t2.so
108 # RUN: not llvm-readelf --notes %t2.so 2>&1 | FileCheck -DFILE=%t2.so %s --check-prefix=ERR1
109 # RUN: not llvm-readobj --notes %t2.so 2>&1 | FileCheck -DFILE=%t2.so %s --check-prefix=ERR1
111 # ERR1: error: '[[FILE]]': SHT_NOTE section [index 1] has invalid offset (0xffff0000) or size (0x0)
124 ## Test tools report an error if a note section has invalid size
125 ## that goes past the end of file.
127 # RUN: yaml2obj --docnum=3 %s > %t3.so
128 # RUN: not llvm-readelf --notes %t3.so 2>&1 | FileCheck -DFILE=%t3.so %s --check-prefix=ERR2
129 # RUN: not llvm-readobj --notes %t3.so 2>&1 | FileCheck -DFILE=%t3.so %s --check-prefix=ERR2
131 # ERR2: error: '[[FILE]]': SHT_NOTE section [index 1] has invalid offset (0x40) or size (0xffff0000)
144 ## Test tools report an error if a note program header has an invalid offset that
145 ## goes past the end of file.
147 # RUN: yaml2obj --docnum=4 %s > %t4.so
148 # RUN: not llvm-readelf --notes %t4.so 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefix=ERR3
149 # RUN: not llvm-readobj --notes %t4.so 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefix=ERR3
151 # ERR3: error: '[[FILE]]': PT_NOTE header has invalid offset (0xffff0000) or size (0x0)
168 ## Test tools report an error if a note program header has an invalid size that
169 ## goes past the end of file.
171 # RUN: yaml2obj --docnum=5 %s > %t5.so
172 # RUN: not llvm-readelf --notes %t5.so 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefix=ERR4
173 # RUN: not llvm-readobj --notes %t5.so 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefix=ERR4
175 # ERR4: error: '[[FILE]]': PT_NOTE header has invalid offset (0x78) or size (0xffff0000)