1# RUN: rm -rf %t && split-file %s %t && cd %t 2 3#--- gnu-42-1.s 4.section ".note.gnu.property", "a" 5 .long 4 // Name length is always 4 ("GNU") 6 .long end - begin // Data length 7 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 8 .asciz "GNU" // Name 9 .p2align 3 10begin: 11 # PAuth ABI property note 12 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 13 .long 16 // Data size 14 .quad 42 // PAuth ABI platform 15 .quad 1 // PAuth ABI version 16 .p2align 3 // Align to 8 byte for 64 bit 17end: 18 19# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-42-1.s -o gnu-42-1.o 20# RUN: llvm-readelf --notes gnu-42-1.o | \ 21# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x2a (unknown)" -DVERSION=0x1 %s 22# RUN: llvm-readobj --notes gnu-42-1.o | \ 23# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x2a (unknown)" -DVERSION=0x1 %s 24 25# ELF: Displaying notes found in: .note.gnu.property 26# ELF-NEXT: Owner Data size Description 27# ELF-NEXT: GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 (property note) 28# ELF-NEXT: AArch64 PAuth ABI core info: platform [[PLATFORM]], version [[VERSION]] 29 30# OBJ: NoteSections [ 31# OBJ-NEXT: NoteSection { 32# OBJ-NEXT: Name: .note.gnu.property 33# OBJ-NEXT: Offset: 0x40 34# OBJ-NEXT: Size: 0x28 35# OBJ-NEXT: Notes [ 36# OBJ-NEXT: { 37# OBJ-NEXT: Owner: GNU 38# OBJ-NEXT: Data size: 0x18 39# OBJ-NEXT: Type: NT_GNU_PROPERTY_TYPE_0 (property note) 40# OBJ-NEXT: Property [ 41# OBJ-NEXT: AArch64 PAuth ABI core info: platform [[PLATFORM]], version [[VERSION]] 42# OBJ-NEXT: ] 43# OBJ-NEXT: } 44# OBJ-NEXT: ] 45# OBJ-NEXT: } 46# OBJ-NEXT: ] 47 48#--- gnu-0-0.s 49.section ".note.gnu.property", "a" 50 .long 4 // Name length is always 4 ("GNU") 51 .long end - begin // Data length 52 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 53 .asciz "GNU" // Name 54 .p2align 3 55begin: 56 # PAuth ABI property note 57 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 58 .long 16 // Data size 59 .quad 0 // PAuth ABI platform 60 .quad 0 // PAuth ABI version 61 .p2align 3 // Align to 8 byte for 64 bit 62end: 63 64# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-0-0.s -o gnu-0-0.o 65# RUN: llvm-readelf --notes gnu-0-0.o | \ 66# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x0 (invalid)" -DVERSION=0x0 %s 67# RUN: llvm-readobj --notes gnu-0-0.o | \ 68# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x0 (invalid)" -DVERSION=0x0 %s 69 70#--- gnu-1-0.s 71.section ".note.gnu.property", "a" 72 .long 4 // Name length is always 4 ("GNU") 73 .long end - begin // Data length 74 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 75 .asciz "GNU" // Name 76 .p2align 3 77begin: 78 # PAuth ABI property note 79 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 80 .long 16 // Data size 81 .quad 1 // PAuth ABI platform 82 .quad 0 // PAuth ABI version 83 .p2align 3 // Align to 8 byte for 64 bit 84end: 85 86# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-1-0.s -o gnu-1-0.o 87# RUN: llvm-readelf --notes gnu-1-0.o | \ 88# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x1 (baremetal)" -DVERSION=0x0 %s 89# RUN: llvm-readobj --notes gnu-1-0.o | \ 90# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x1 (baremetal)" -DVERSION=0x0 %s 91 92#--- gnu-0x10000002-0.s 93.section ".note.gnu.property", "a" 94 .long 4 // Name length is always 4 ("GNU") 95 .long end - begin // Data length 96 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 97 .asciz "GNU" // Name 98 .p2align 3 99begin: 100 # PAuth ABI property note 101 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 102 .long 16 // Data size 103 .quad 0x10000002 // PAuth ABI platform 104 .quad 0 // PAuth ABI version 105 .p2align 3 // Align to 8 byte for 64 bit 106end: 107 108# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-0x10000002-0.s -o gnu-0x10000002-0.o 109# RUN: llvm-readelf --notes gnu-0x10000002-0.o | \ 110# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x10000002 (llvm_linux)" \ 111# RUN: -DVERSION="0x0 (!PointerAuthIntrinsics, !PointerAuthCalls, !PointerAuthReturns, !PointerAuthAuthTraps, !PointerAuthVTPtrAddressDiscrimination, !PointerAuthVTPtrTypeDiscrimination, !PointerAuthInitFini, !PointerAuthInitFiniAddressDiscrimination, !PointerAuthELFGOT, !PointerAuthIndirectGotos, !PointerAuthTypeInfoVTPtrDiscrimination, !PointerAuthFPtrTypeDiscrimination)" %s 112# RUN: llvm-readobj --notes gnu-0x10000002-0.o | \ 113# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x10000002 (llvm_linux)" \ 114# RUN: -DVERSION="0x0 (!PointerAuthIntrinsics, !PointerAuthCalls, !PointerAuthReturns, !PointerAuthAuthTraps, !PointerAuthVTPtrAddressDiscrimination, !PointerAuthVTPtrTypeDiscrimination, !PointerAuthInitFini, !PointerAuthInitFiniAddressDiscrimination, !PointerAuthELFGOT, !PointerAuthIndirectGotos, !PointerAuthTypeInfoVTPtrDiscrimination, !PointerAuthFPtrTypeDiscrimination)" %s 115 116#--- gnu-0x10000002-1365.s 117.section ".note.gnu.property", "a" 118 .long 4 // Name length is always 4 ("GNU") 119 .long end - begin // Data length 120 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 121 .asciz "GNU" // Name 122 .p2align 3 123begin: 124 # PAuth ABI property note 125 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 126 .long 16 // Data size 127 .quad 0x10000002 // PAuth ABI platform 128 .quad 1365 // PAuth ABI version 129 .p2align 3 // Align to 8 byte for 64 bit 130end: 131 132# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-0x10000002-1365.s -o gnu-0x10000002-1365.o 133# RUN: llvm-readelf --notes gnu-0x10000002-1365.o | \ 134# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x10000002 (llvm_linux)" \ 135# RUN: -DVERSION="0x555 (PointerAuthIntrinsics, !PointerAuthCalls, PointerAuthReturns, !PointerAuthAuthTraps, PointerAuthVTPtrAddressDiscrimination, !PointerAuthVTPtrTypeDiscrimination, PointerAuthInitFini, !PointerAuthInitFiniAddressDiscrimination, PointerAuthELFGOT, !PointerAuthIndirectGotos, PointerAuthTypeInfoVTPtrDiscrimination, !PointerAuthFPtrTypeDiscrimination)" %s 136# RUN: llvm-readobj --notes gnu-0x10000002-1365.o | \ 137# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x10000002 (llvm_linux)" \ 138# RUN: -DVERSION="0x555 (PointerAuthIntrinsics, !PointerAuthCalls, PointerAuthReturns, !PointerAuthAuthTraps, PointerAuthVTPtrAddressDiscrimination, !PointerAuthVTPtrTypeDiscrimination, PointerAuthInitFini, !PointerAuthInitFiniAddressDiscrimination, PointerAuthELFGOT, !PointerAuthIndirectGotos, PointerAuthTypeInfoVTPtrDiscrimination, !PointerAuthFPtrTypeDiscrimination)" %s 139 140#--- gnu-0x10000002-2730.s 141.section ".note.gnu.property", "a" 142 .long 4 // Name length is always 4 ("GNU") 143 .long end - begin // Data length 144 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 145 .asciz "GNU" // Name 146 .p2align 3 147begin: 148 # PAuth ABI property note 149 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 150 .long 16 // Data size 151 .quad 0x10000002 // PAuth ABI platform 152 .quad 2730 // PAuth ABI version 153 .p2align 3 // Align to 8 byte for 64 bit 154end: 155 156# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-0x10000002-2730.s -o gnu-0x10000002-2730.o 157# RUN: llvm-readelf --notes gnu-0x10000002-2730.o | \ 158# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x10000002 (llvm_linux)" \ 159# RUN: -DVERSION="0xaaa (!PointerAuthIntrinsics, PointerAuthCalls, !PointerAuthReturns, PointerAuthAuthTraps, !PointerAuthVTPtrAddressDiscrimination, PointerAuthVTPtrTypeDiscrimination, !PointerAuthInitFini, PointerAuthInitFiniAddressDiscrimination, !PointerAuthELFGOT, PointerAuthIndirectGotos, !PointerAuthTypeInfoVTPtrDiscrimination, PointerAuthFPtrTypeDiscrimination)" %s 160# RUN: llvm-readobj --notes gnu-0x10000002-2730.o | \ 161# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x10000002 (llvm_linux)" \ 162# RUN: -DVERSION="0xaaa (!PointerAuthIntrinsics, PointerAuthCalls, !PointerAuthReturns, PointerAuthAuthTraps, !PointerAuthVTPtrAddressDiscrimination, PointerAuthVTPtrTypeDiscrimination, !PointerAuthInitFini, PointerAuthInitFiniAddressDiscrimination, !PointerAuthELFGOT, PointerAuthIndirectGotos, !PointerAuthTypeInfoVTPtrDiscrimination, PointerAuthFPtrTypeDiscrimination)" %s 163 164#--- gnu-0x10000002-4095.s 165.section ".note.gnu.property", "a" 166 .long 4 // Name length is always 4 ("GNU") 167 .long end - begin // Data length 168 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 169 .asciz "GNU" // Name 170 .p2align 3 171begin: 172 # PAuth ABI property note 173 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 174 .long 16 // Data size 175 .quad 0x10000002 // PAuth ABI platform 176 .quad 4095 // PAuth ABI version 177 .p2align 3 // Align to 8 byte for 64 bit 178end: 179 180# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-0x10000002-4095.s -o gnu-0x10000002-4095.o 181# RUN: llvm-readelf --notes gnu-0x10000002-4095.o | \ 182# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x10000002 (llvm_linux)" \ 183# RUN: -DVERSION="0xfff (PointerAuthIntrinsics, PointerAuthCalls, PointerAuthReturns, PointerAuthAuthTraps, PointerAuthVTPtrAddressDiscrimination, PointerAuthVTPtrTypeDiscrimination, PointerAuthInitFini, PointerAuthInitFiniAddressDiscrimination, PointerAuthELFGOT, PointerAuthIndirectGotos, PointerAuthTypeInfoVTPtrDiscrimination, PointerAuthFPtrTypeDiscrimination)" %s 184# RUN: llvm-readobj --notes gnu-0x10000002-4095.o | \ 185# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x10000002 (llvm_linux)" \ 186# RUN: -DVERSION="0xfff (PointerAuthIntrinsics, PointerAuthCalls, PointerAuthReturns, PointerAuthAuthTraps, PointerAuthVTPtrAddressDiscrimination, PointerAuthVTPtrTypeDiscrimination, PointerAuthInitFini, PointerAuthInitFiniAddressDiscrimination, PointerAuthELFGOT, PointerAuthIndirectGotos, PointerAuthTypeInfoVTPtrDiscrimination, PointerAuthFPtrTypeDiscrimination)" %s 187 188#--- gnu-0x10000002-4096.s 189.section ".note.gnu.property", "a" 190 .long 4 // Name length is always 4 ("GNU") 191 .long end - begin // Data length 192 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 193 .asciz "GNU" // Name 194 .p2align 3 195begin: 196 # PAuth ABI property note 197 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 198 .long 16 // Data size 199 .quad 0x10000002 // PAuth ABI platform 200 .quad 4096 // PAuth ABI version 201 .p2align 3 // Align to 8 byte for 64 bit 202end: 203 204# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-0x10000002-4096.s -o gnu-0x10000002-4096.o 205# RUN: llvm-readelf --notes gnu-0x10000002-4096.o | \ 206# RUN: FileCheck --check-prefix=ELF -DPLATFORM="0x10000002 (llvm_linux)" -DVERSION="0x1000 (unknown)" %s 207# RUN: llvm-readobj --notes gnu-0x10000002-4096.o | \ 208# RUN: FileCheck --check-prefix=OBJ -DPLATFORM="0x10000002 (llvm_linux)" -DVERSION="0x1000 (unknown)" %s 209 210#--- gnu-short.s 211.section ".note.gnu.property", "a" 212 .long 4 // Name length is always 4 ("GNU") 213 .long end - begin // Data length 214 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 215 .asciz "GNU" // Name 216 .p2align 3 217begin: 218 # PAuth ABI property note 219 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 220 .long 12 // Data size 221 .quad 42 // PAuth ABI platform 222 .word 1 // PAuth ABI version 223 .p2align 3 // Align to 8 byte for 64 bit 224end: 225 226# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-short.s -o gnu-short.o 227# RUN: llvm-readelf --notes gnu-short.o | \ 228# RUN: FileCheck --check-prefix=ELF-ERR -DSIZE=28 -DDATASIZE=18 \ 229# RUN: -DERR="<corrupted size: expected 16, got 12>" %s 230# RUN: llvm-readobj --notes gnu-short.o | \ 231# RUN: FileCheck --check-prefix=OBJ-ERR -DSIZE=28 -DDATASIZE=18 \ 232# RUN: -DERR="<corrupted size: expected 16, got 12>" %s 233 234# ELF-ERR: Displaying notes found in: .note.gnu.property 235# ELF-ERR-NEXT: Owner Data size Description 236# ELF-ERR-NEXT: GNU 0x000000[[DATASIZE]] NT_GNU_PROPERTY_TYPE_0 (property note) 237# ELF-ERR-NEXT: AArch64 PAuth ABI core info: [[ERR]] 238 239# OBJ-ERR: NoteSections [ 240# OBJ-ERR-NEXT: NoteSection { 241# OBJ-ERR-NEXT: Name: .note.gnu.property 242# OBJ-ERR-NEXT: Offset: 0x40 243# OBJ-ERR-NEXT: Size: 0x[[SIZE]] 244# OBJ-ERR-NEXT: Notes [ 245# OBJ-ERR-NEXT: { 246# OBJ-ERR-NEXT: Owner: GNU 247# OBJ-ERR-NEXT: Data size: 0x[[DATASIZE]] 248# OBJ-ERR-NEXT: Type: NT_GNU_PROPERTY_TYPE_0 (property note) 249# OBJ-ERR-NEXT: Property [ 250# OBJ-ERR-NEXT: AArch64 PAuth ABI core info: [[ERR]] 251# OBJ-ERR-NEXT: ] 252# OBJ-ERR-NEXT: } 253# OBJ-ERR-NEXT: ] 254# OBJ-ERR-NEXT: } 255# OBJ-ERR-NEXT: ] 256 257#--- gnu-long.s 258.section ".note.gnu.property", "a" 259 .long 4 // Name length is always 4 ("GNU") 260 .long end - begin // Data length 261 .long 5 // Type: NT_GNU_PROPERTY_TYPE_0 262 .asciz "GNU" // Name 263 .p2align 3 264begin: 265 # PAuth ABI property note 266 .long 0xc0000001 // Type: GNU_PROPERTY_AARCH64_FEATURE_PAUTH 267 .long 24 // Data size 268 .quad 42 // PAuth ABI platform 269 .quad 1 // PAuth ABI version 270 .quad 0x0123456789ABCDEF 271 .p2align 3 // Align to 8 byte for 64 bit 272end: 273 274# RUN: llvm-mc -filetype=obj -triple aarch64-linux-gnu gnu-long.s -o gnu-long.o 275# RUN: llvm-readelf --notes gnu-long.o | \ 276# RUN: FileCheck --check-prefix=ELF-ERR -DSIZE=30 -DDATASIZE=20 \ 277# RUN: -DERR="<corrupted size: expected 16, got 24>" %s 278# RUN: llvm-readobj --notes gnu-long.o | \ 279# RUN: FileCheck --check-prefix=OBJ-ERR -DSIZE=30 -DDATASIZE=20 \ 280# RUN: -DERR="<corrupted size: expected 16, got 24>" %s 281