Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / llvm-readobj / note-gnu-property.s
blob931dce6ba8fb5cd144c66cca3e620819536bc355
1 // REQUIRES: x86-registered-target
2 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
3 // RUN: llvm-readelf --notes %t | FileCheck %s --check-prefix=GNU
4 // RUN: llvm-readobj --elf-output-style LLVM --notes %t | FileCheck %s --check-prefix=LLVM
6 // GNU: Displaying notes found at file offset 0x00000040 with length 0x000000f8:
7 // GNU-NEXT: Owner Data size Description
8 // GNU-NEXT: GNU 0x000000e8 NT_GNU_PROPERTY_TYPE_0 (property note)
9 // GNU-NEXT: Properties: stack size: 0x100
10 // GNU-NEXT: stack size: 0x100
11 // GNU-NEXT: no copy on protected
12 // GNU-NEXT: x86 feature: SHSTK
13 // GNU-NEXT: x86 feature: IBT, SHSTK
14 // GNU-NEXT: x86 feature: <None>
15 // GNU-NEXT: x86 ISA needed: CMOV, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2, FMA, AVX512F, AVX512CD
16 // GNU-NEXT: x86 ISA used: AVX512ER, AVX512PF, AVX512VL, AVX512DQ, AVX512BW, AVX512_4FMAPS, AVX512_4VNNIW, AVX512_BITALG, AVX512_IFMA, AVX512_VBMI, AVX512_VBMI2, AVX512_VNNI
17 // GNU-NEXT: x86 feature needed: x86, x87, MMX, XMM, YMM
18 // GNU-NEXT: x86 feature used: ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC
19 // GNU-NEXT: <application-specific type 0xfefefefe>
20 // GNU-NEXT: stack size: <corrupt length: 0x0>
21 // GNU-NEXT: stack size: <corrupt length: 0x4>
22 // GNU-NEXT: no copy on protected <corrupt length: 0x1>
23 // GNU-NEXT: x86 feature: <corrupt length: 0x0>
24 // GNU-NEXT: x86 feature: IBT, <unknown flags: 0xf000f000>
25 // GNU-NEXT: <corrupt type (0x2) datasz: 0x1>
27 // LLVM: Notes [
28 // LLVM-NEXT: NoteSection {
29 // LLVM-NEXT: Offset: 0x40
30 // LLVM-NEXT: Size: 0xF8
31 // LLVM-NEXT: Note {
32 // LLVM-NEXT: Owner: GNU
33 // LLVM-NEXT: Data size: 0xE8
34 // LLVM-NEXT: Type: NT_GNU_PROPERTY_TYPE_0 (property note)
35 // LLVM-NEXT: Property [
36 // LLVM-NEXT: stack size: 0x100
37 // LLVM-NEXT: stack size: 0x100
38 // LLVM-NEXT: no copy on protected
39 // LLVM-NEXT: x86 feature: SHSTK
40 // LLVM-NEXT: x86 feature: IBT, SHSTK
41 // LLVM-NEXT: x86 feature: <None>
42 // LLVM-NEXT: x86 ISA needed: CMOV, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2, FMA, AVX512F, AVX512CD
43 // LLVM-NEXT: x86 ISA used: AVX512ER, AVX512PF, AVX512VL, AVX512DQ, AVX512BW, AVX512_4FMAPS, AVX512_4VNNIW, AVX512_BITALG, AVX512_IFMA, AVX512_VBMI, AVX512_VBMI2, AVX512_VNNI
44 // LLVM-NEXT: x86 feature needed: x86, x87, MMX, XMM, YMM
45 // LLVM-NEXT: x86 feature used: ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC
46 // LLVM-NEXT: <application-specific type 0xfefefefe>
47 // LLVM-NEXT: stack size: <corrupt length: 0x0>
48 // LLVM-NEXT: stack size: <corrupt length: 0x4>
49 // LLVM-NEXT: no copy on protected <corrupt length: 0x1>
50 // LLVM-NEXT: x86 feature: <corrupt length: 0x0>
51 // LLVM-NEXT: x86 feature: IBT, <unknown flags: 0xf000f000>
52 // LLVM-NEXT: <corrupt type (0x2) datasz: 0x1>
53 // LLVM-NEXT: ]
54 // LLVM-NEXT: }
55 // LLVM-NEXT: }
56 // LLVM-NEXT: ]
58 .section ".note.gnu.property", "a"
59 .align 4
60 .long 4 /* Name length is always 4 ("GNU") */
61 .long end - begin /* Data length */
62 .long 5 /* Type: NT_GNU_PROPERTY_TYPE_0 */
63 .asciz "GNU" /* Name */
64 .p2align 3
65 begin:
66 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */
67 .long 8 /* Data size */
68 .quad 0x100 /* Data (stack size) */
69 .p2align 3 /* Align to 8 byte for 64 bit */
71 /* Test we handle alignment properly */
72 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */
73 .long 8 /* Data size */
74 .long 0x100 /* Data (stack size) */
75 .p2align 3 /* Align to 8 byte for 64 bit */
77 .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */
78 .long 0 /* Data size */
79 .p2align 3 /* Align to 8 byte for 64 bit */
81 /* CET property note */
82 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
83 .long 4 /* Data size */
84 .long 2 /* GNU_PROPERTY_X86_FEATURE_1_SHSTK */
85 .p2align 3 /* Align to 8 byte for 64 bit */
87 /* CET property note with padding */
88 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
89 .long 4 /* Data size */
90 .long 3 /* Full CET support */
91 .p2align 3 /* Align to 8 byte for 64 bit */
93 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
94 .long 4 /* Data size */
95 .long 0 /* Empty flags, not an error */
96 .p2align 3 /* Align to 8 byte for 64 bit */
98 .long 0xc0008000 /* Type: GNU_PROPERTY_X86_ISA_1_NEEDED */
99 .long 4 /* Data size */
100 .long 0x00000fff /* CMOV, ... */
101 .p2align 3 /* Align to 8 byte for 64 bit */
103 .long 0xc0010000 /* Type: GNU_PROPERTY_X86_ISA_1_USED */
104 .long 4 /* Data size */
105 .long 0x00fff000 /* AVX512_ER, ... */
106 .p2align 3 /* Align to 8 byte for 64 bit */
108 .long 0xc0008001 /* Type: GNU_PROPERTY_X86_FEATURE_2_NEEDED */
109 .long 4 /* Data size */
110 .long 0x0000001f /* X86, ... */
111 .p2align 3 /* Align to 8 byte for 64 bit */
113 .long 0xc0010001 /* Type: GNU_PROPERTY_X86_FEATURE_2_USED */
114 .long 4 /* Data size */
115 .long 0x000003e0 /* ZMM, ... */
116 .p2align 3 /* Align to 8 byte for 64 bit */
118 /* All notes below are broken. Test we are able to report them. */
120 /* Broken note type */
121 .long 0xfefefefe /* Invalid type for testing */
122 .long 0 /* Data size */
123 .p2align 3 /* Align to 8 byte for 64 bit */
125 /* GNU_PROPERTY_STACK_SIZE with zero stack size */
126 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */
127 .long 0 /* Data size */
128 .p2align 3 /* Align to 8 byte for 64 bit */
130 /* GNU_PROPERTY_STACK_SIZE with data size 4 (should be 8) */
131 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */
132 .long 4 /* Data size */
133 .long 0x100 /* Data (stack size) */
134 .p2align 3 /* Align to 8 byte for 64 bit */
136 /* GNU_PROPERTY_NO_COPY_ON_PROTECTED with pr_datasz and some data */
137 .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */
138 .long 1 /* Data size (corrupted) */
139 .byte 1 /* Data */
140 .p2align 3 /* Align to 8 byte for 64 bit */
142 /* CET note with size zero */
143 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
144 .long 0 /* Data size */
145 .p2align 3 /* Align to 8 byte for 64 bit */
147 /* CET note with bad flags */
148 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */
149 .long 4 /* Data size */
150 .long 0xf000f001 /* GNU_PROPERTY_X86_FEATURE_1_IBT and bad bits */
151 .p2align 3 /* Align to 8 byte for 64 bit */
153 /* GNU_PROPERTY_NO_COPY_ON_PROTECTED with pr_datasz and without data */
154 .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */
155 .long 1 /* Data size (corrupted) */
156 .p2align 3 /* Align to 8 byte for 64 bit */
157 end: