161 lines · plain
1// REQUIRES: x86-registered-target2// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t3// RUN: llvm-readelf --notes %t | FileCheck %s --check-prefix=GNU4// RUN: llvm-readobj --elf-output-style LLVM --notes %t | FileCheck %s --check-prefix=LLVM5 6// GNU: Displaying notes found in: .note.gnu.property7// GNU-NEXT: Owner Data size Description8// GNU-NEXT: GNU 0x000000e8 NT_GNU_PROPERTY_TYPE_0 (property note)9// GNU-NEXT: Properties: stack size: 0x10010// GNU-NEXT: stack size: 0x10011// GNU-NEXT: no copy on protected12// GNU-NEXT: x86 feature: SHSTK13// GNU-NEXT: x86 feature: IBT, SHSTK14// GNU-NEXT: x86 feature: <None>15// GNU-NEXT: x86 feature needed: x86, x87, MMX, XMM, YMM16// GNU-NEXT: x86 feature used: ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC17// GNU-NEXT: x86 ISA needed: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v418// GNU-NEXT: x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v419// 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>26 27// LLVM: NoteSections [28// LLVM-NEXT: NoteSection {29// LLVM-NEXT: Name: .note.gnu.property30// LLVM-NEXT: Offset: 0x4031// LLVM-NEXT: Size: 0xF832// LLVM-NEXT: Notes [33// LLVM-NEXT: {34// LLVM-NEXT: Owner: GNU35// LLVM-NEXT: Data size: 0xE836// LLVM-NEXT: Type: NT_GNU_PROPERTY_TYPE_0 (property note)37// LLVM-NEXT: Property [38// LLVM-NEXT: stack size: 0x10039// LLVM-NEXT: stack size: 0x10040// LLVM-NEXT: no copy on protected41// LLVM-NEXT: x86 feature: SHSTK42// LLVM-NEXT: x86 feature: IBT, SHSTK43// LLVM-NEXT: x86 feature: <None>44// LLVM-NEXT: x86 feature needed: x86, x87, MMX, XMM, YMM45// LLVM-NEXT: x86 feature used: ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC46// LLVM-NEXT: x86 ISA needed: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v447// LLVM-NEXT: x86 ISA used: x86-64-baseline, x86-64-v2, x86-64-v3, x86-64-v448// LLVM-NEXT: <application-specific type 0xfefefefe>49// LLVM-NEXT: stack size: <corrupt length: 0x0>50// LLVM-NEXT: stack size: <corrupt length: 0x4>51// LLVM-NEXT: no copy on protected <corrupt length: 0x1>52// LLVM-NEXT: x86 feature: <corrupt length: 0x0>53// LLVM-NEXT: x86 feature: IBT, <unknown flags: 0xf000f000>54// LLVM-NEXT: <corrupt type (0x2) datasz: 0x1>55// LLVM-NEXT: ]56// LLVM-NEXT: }57// LLVM-NEXT: ]58// LLVM-NEXT: }59// LLVM-NEXT: ]60 61.section ".note.gnu.property", "a"62.align 463 .long 4 /* Name length is always 4 ("GNU") */64 .long end - begin /* Data length */65 .long 5 /* Type: NT_GNU_PROPERTY_TYPE_0 */66 .asciz "GNU" /* Name */67 .p2align 368begin:69 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */70 .long 8 /* Data size */71 .quad 0x100 /* Data (stack size) */72 .p2align 3 /* Align to 8 byte for 64 bit */73 74 /* Test we handle alignment properly */75 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */76 .long 8 /* Data size */77 .long 0x100 /* Data (stack size) */78 .p2align 3 /* Align to 8 byte for 64 bit */79 80 .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */81 .long 0 /* Data size */82 .p2align 3 /* Align to 8 byte for 64 bit */83 84 /* CET property note */85 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */86 .long 4 /* Data size */87 .long 2 /* GNU_PROPERTY_X86_FEATURE_1_SHSTK */88 .p2align 3 /* Align to 8 byte for 64 bit */89 90 /* CET property note with padding */91 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */92 .long 4 /* Data size */93 .long 3 /* Full CET support */94 .p2align 3 /* Align to 8 byte for 64 bit */95 96 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */97 .long 4 /* Data size */98 .long 0 /* Empty flags, not an error */99 .p2align 3 /* Align to 8 byte for 64 bit */100 101 .long 0xc0008001 /* Type: GNU_PROPERTY_X86_FEATURE_2_NEEDED */102 .long 4 /* Data size */103 .long 0x0000001f /* X86, ... */104 .p2align 3 /* Align to 8 byte for 64 bit */105 106 .long 0xc0010001 /* Type: GNU_PROPERTY_X86_FEATURE_2_USED */107 .long 4 /* Data size */108 .long 0x000003e0 /* ZMM, ... */109 .p2align 3 /* Align to 8 byte for 64 bit */110 111 .long 0xc0008002 /* Type: GNU_PROPERTY_X86_ISA_1_NEEDED */112 .long 4 /* Data size */113 .long 0x0000000f /* x86-64-baseline, ... */114 .p2align 3 /* Align to 8 byte for 64 bit */115 116 .long 0xc0010002 /* Type: GNU_PROPERTY_X86_ISA_1_USED */117 .long 4 /* Data size */118 .long 0x0000000f /* x86-64-baseline, ... */119 .p2align 3 /* Align to 8 byte for 64 bit */120 121 /* All notes below are broken. Test we are able to report them. */122 123 /* Broken note type */124 .long 0xfefefefe /* Invalid type for testing */125 .long 0 /* Data size */126 .p2align 3 /* Align to 8 byte for 64 bit */127 128 /* GNU_PROPERTY_STACK_SIZE with zero stack size */129 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */130 .long 0 /* Data size */131 .p2align 3 /* Align to 8 byte for 64 bit */132 133 /* GNU_PROPERTY_STACK_SIZE with data size 4 (should be 8) */134 .long 1 /* Type: GNU_PROPERTY_STACK_SIZE */135 .long 4 /* Data size */136 .long 0x100 /* Data (stack size) */137 .p2align 3 /* Align to 8 byte for 64 bit */138 139 /* GNU_PROPERTY_NO_COPY_ON_PROTECTED with pr_datasz and some data */140 .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */141 .long 1 /* Data size (corrupted) */142 .byte 1 /* Data */143 .p2align 3 /* Align to 8 byte for 64 bit */144 145 /* CET note with size zero */146 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */147 .long 0 /* Data size */148 .p2align 3 /* Align to 8 byte for 64 bit */149 150 /* CET note with bad flags */151 .long 0xc0000002 /* Type: GNU_PROPERTY_X86_FEATURE_1_AND */152 .long 4 /* Data size */153 .long 0xf000f001 /* GNU_PROPERTY_X86_FEATURE_1_IBT and bad bits */154 .p2align 3 /* Align to 8 byte for 64 bit */155 156 /* GNU_PROPERTY_NO_COPY_ON_PROTECTED with pr_datasz and without data */157 .long 2 /* Type: GNU_PROPERTY_NO_COPY_ON_PROTECTED */158 .long 1 /* Data size (corrupted) */159 .p2align 3 /* Align to 8 byte for 64 bit */160end:161