177 lines · plain
1# REQUIRES: aarch642 3# RUN: rm -rf %t && split-file %s %t && cd %t4 5# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag1.s -o tag1.o6# RUN: cp tag1.o tag1a.o7# RUN: ld.lld -shared tag1.o tag1a.o -o tagok.so8# RUN: llvm-readelf -n tagok.so | FileCheck --check-prefix OK %s9 10# OK: AArch64 PAuth ABI core info: platform 0x2a (unknown), version 0x111 12# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag2.s -o tag2.o13# RUN: not ld.lld tag1.o tag1a.o tag2.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR1 %s14 15# ERR1: error: incompatible values of AArch64 PAuth core info found16# ERR1-NEXT: platform:17# ERR1-NEXT: >>> tag1.o: 0x2a18# ERR1-NEXT: >>> tag2.o: 0x2a19# ERR1-NEXT: version:20# ERR1-NEXT: >>> tag1.o: 0x0121# ERR1-NEXT: >>> tag2.o: 0x0222 23# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-short.s -o short.o24# RUN: not ld.lld short.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR2 %s25 26# ERR2: error: short.o:(.note.gnu.property+0x0): GNU_PROPERTY_AARCH64_FEATURE_PAUTH entry is invalid: expected 16 bytes, but got 1227 28# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-long.s -o long.o29# RUN: not ld.lld long.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR3 %s30 31# ERR3: error: long.o:(.note.gnu.property+0x0): GNU_PROPERTY_AARCH64_FEATURE_PAUTH entry is invalid: expected 16 bytes, but got 2432 33# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-multiple.s -o multiple.o34# RUN: not ld.lld multiple.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR4 %s35# ERR4: error: multiple.o:(.note.gnu.property+0x0): multiple GNU_PROPERTY_AARCH64_FEATURE_PAUTH entries are not supported36 37# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu no-info.s -o noinfo1.o38# RUN: cp noinfo1.o noinfo2.o39# RUN: not ld.lld -z pauth-report=error noinfo1.o tag1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR5 %s40# RUN: ld.lld -z pauth-report=warning noinfo1.o tag1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix WARN1 %s41# RUN: ld.lld -z pauth-report=none noinfo1.o tag1.o noinfo2.o --fatal-warnings -o /dev/null42 43# ERR5: error: noinfo1.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one44# ERR5-NEXT: error: noinfo2.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one45# WARN1: warning: noinfo1.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one46# WARN1-NEXT: warning: noinfo2.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one47 48# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-zero.s -o tag-zero.o49# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %p/Inputs/aarch64-func2.s -o func2.o50# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %p/Inputs/aarch64-func3.s -o func3.o51# RUN: ld.lld func3.o --shared -o func3.so52# RUN: ld.lld tag1.o func2.o func3.so -z pac-plt --shared -o pacplt-nowarn --fatal-warnings53# RUN: ld.lld tag-zero.o func2.o func3.so -z pac-plt --shared -o pacplt-warn 2>&1 | FileCheck --check-prefix WARN2 %s54 55# WARN2: warning: tag-zero.o: -z pac-plt: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_PAC property and no valid PAuth core info present for this link job56# WARN2-NEXT: warning: func2.o: -z pac-plt: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_PAC property and no valid PAuth core info present for this link job57 58# RUN: llvm-readelf -d pacplt-nowarn | FileCheck --check-prefix=PACPLTTAG %s59# RUN: llvm-readelf -d pacplt-warn | FileCheck --check-prefix=PACPLTTAG %s60 61# PACPLTTAG: 0x0000000070000003 (AARCH64_PAC_PLT)62 63# RUN: llvm-objdump -d pacplt-nowarn | FileCheck --check-prefixes=PACPLT,NOHINT -DA=10380 -DB=478 -DC=480 %s64# RUN: llvm-objdump -d pacplt-warn | FileCheck --check-prefixes=PACPLT,HINT -DA=10390 -DB=488 -DC=490 %s65 66# PACPLT: Disassembly of section .text:67# PACPLT: <func2>:68# PACPLT-NEXT: bl 0x[[A]] <func3@plt>69# PACPLT-NEXT: ret70# PACPLT: Disassembly of section .plt:71# PACPLT: <.plt>:72# PACPLT-NEXT: stp x16, x30, [sp, #-0x10]!73# PACPLT-NEXT: adrp x16, 0x30000 <func3+0x30000>74# PACPLT-NEXT: ldr x17, [x16, #0x[[B]]]75# PACPLT-NEXT: add x16, x16, #0x[[B]]76# PACPLT-NEXT: br x1777# PACPLT-NEXT: nop78# PACPLT-NEXT: nop79# PACPLT-NEXT: nop80# PACPLT: <func3@plt>:81# PACPLT-NEXT: adrp x16, 0x30000 <func3+0x30000>82# PACPLT-NEXT: ldr x17, [x16, #0x[[C]]]83# PACPLT-NEXT: add x16, x16, #0x[[C]]84# NOHINT-NEXT: braa x17, x1685# NOHINT-NEXT: nop86# HINT-NEXT: autia171687# HINT-NEXT: br x1788# PACPLT-NEXT: nop89 90# RUN: not ld.lld tag1.o -z pauth-report=u 2>&1 | FileCheck --check-prefix=REPORT-ERR %s91# REPORT-ERR: error: unknown -z pauth-report= value: u{{$}}92# REPORT-EMPTY:93 94#--- abi-tag-short.s95 96.section ".note.gnu.property", "a"97.long 498.long 2099.long 5100.asciz "GNU"101.long 0xc0000001102.long 12103.quad 2104.long 31105 106#--- abi-tag-long.s107 108.section ".note.gnu.property", "a"109.long 4110.long 32111.long 5112.asciz "GNU"113.long 0xc0000001114.long 24115.quad 2116.quad 31117.quad 0118 119#--- abi-tag-multiple.s120 121.section ".note.gnu.property", "a"122.long 4123.long 48124.long 5125.asciz "GNU"126.long 0xc0000001127.long 16128.quad 42 // platform129.quad 1 // version130.long 0xc0000001131.long 16132.quad 42 // platform133.quad 1 // version134 135#--- abi-tag1.s136 137.section ".note.gnu.property", "a"138.long 4139.long 24140.long 5141.asciz "GNU"142.long 0xc0000001143.long 16144.quad 42 // platform145.quad 1 // version146 147#--- abi-tag2.s148 149.section ".note.gnu.property", "a"150.long 4151.long 24152.long 5153.asciz "GNU"154.long 0xc0000001155.long 16156.quad 42 // platform157.quad 2 // version158 159#--- abi-tag-zero.s160 161.section ".note.gnu.property", "a"162.long 4163.long 24164.long 5165.asciz "GNU"166.long 0xc0000001167.long 16168.quad 0 // platform169.quad 0 // version170 171#--- no-info.s172 173## define _start to avoid missing entry warning and use --fatal-warnings to assert no diagnostic174## allow multiple definitions of _start for simplicity175.weak _start;176_start:177