135 lines · plain
1// REQUIRES: aarch642// RUN: rm -rf %t && split-file %s %t && cd %t3 4//--- a.s5.section .tbss,"awT",@nobits6.global a7a:8.xword 09 10//--- ok.s11// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux -mattr=+pauth ok.s -o ok.o12// RUN: ld.lld -shared ok.o -o ok.so13// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn ok.so | \14// RUN: FileCheck -DP=20 -DA=896 -DB=912 -DC=928 %s15// RUN: llvm-readobj -r -x .got ok.so | FileCheck --check-prefix=REL \16// RUN: -DP1=20 -DA1=380 -DB1=390 -DC1=3A0 -DP2=020 -DA2=380 -DB2=390 -DC2=3a0 %s17 18// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux -mattr=+pauth a.s -o a.so.o19// RUN: ld.lld -shared a.so.o -soname=so -o a.so20// RUN: ld.lld ok.o a.so -o ok21// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn ok | \22// RUN: FileCheck -DP=220 -DA=936 -DB=952 -DC=968 %s23// RUN: llvm-readobj -r -x .got ok | FileCheck --check-prefix=REL \24// RUN: -DP1=220 -DA1=3A8 -DB1=3B8 -DC1=3C8 -DP2=220 -DA2=3a8 -DB2=3b8 -DC2=3c8 %s25 26 .text27 adrp x0, :tlsdesc_auth:a28 ldr x16, [x0, :tlsdesc_auth_lo12:a]29 add x0, x0, :tlsdesc_auth_lo12:a30 blraa x16, x031 32// CHECK: adrp x0, 0x[[P]]00033// CHECK-NEXT: ldr x16, [x0, #[[A]]]34// CHECK-NEXT: add x0, x0, #[[A]]35// CHECK-NEXT: blraa x16, x036 37/// Create relocation against local TLS symbols where linker should38/// create target specific dynamic TLSDESC relocation where addend is39/// the symbol VMA in tls block.40 41 adrp x0, :tlsdesc_auth:local142 ldr x16, [x0, :tlsdesc_auth_lo12:local1]43 add x0, x0, :tlsdesc_auth_lo12:local144 blraa x16, x045 46// CHECK: adrp x0, 0x[[P]]00047// CHECK-NEXT: ldr x16, [x0, #[[B]]]48// CHECK-NEXT: add x0, x0, #[[B]]49// CHECK-NEXT: blraa x16, x050 51 adrp x0, :tlsdesc_auth:local252 ldr x16, [x0, :tlsdesc_auth_lo12:local2]53 add x0, x0, :tlsdesc_auth_lo12:local254 blraa x16, x055 56// CHECK: adrp x0, 0x[[P]]00057// CHECK-NEXT: ldr x16, [x0, #[[C]]]58// CHECK-NEXT: add x0, x0, #[[C]]59// CHECK-NEXT: blraa x16, x060 61 .section .tbss,"awT",@nobits62 .type local1,@object63 .p2align 264local1:65 .word 066 .size local1, 467 68 .type local2,@object69 .p2align 370local2:71 .xword 072 .size local2, 873 74 75// R_AARCH64_AUTH_TLSDESC - 0x0 -> start of tls block76// R_AARCH64_AUTH_TLSDESC - 0x8 -> align (sizeof (local1), 8)77 78// REL: Relocations [79// REL-NEXT: Section (5) .rela.dyn {80// REL-NEXT: 0x[[P1]][[B1]] R_AARCH64_AUTH_TLSDESC - 0x081// REL-NEXT: 0x[[P1]][[C1]] R_AARCH64_AUTH_TLSDESC - 0x882// REL-NEXT: 0x[[P1]][[A1]] R_AARCH64_AUTH_TLSDESC a 0x083// REL-NEXT: }84// REL-NEXT: ]85 86// REL: Hex dump of section '.got':87// REL-NEXT: 0x00[[P2]][[A2]] 00000000 00000080 00000000 000000a088// REL-NEXT: 0x00[[P2]][[B2]] 00000000 00000080 00000000 000000a089// REL-NEXT: 0x00[[P2]][[C2]] 00000000 00000080 00000000 000000a090/// ^^91/// 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA92/// ^^93/// 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA94 95//--- err1.s96// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux -mattr=+pauth err1.s -o err1.o97// RUN: not ld.lld -shared err1.o 2>&1 | FileCheck --check-prefix=ERR1 --implicit-check-not=error: %s98// ERR1: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported99 .text100 adrp x0, :tlsdesc_auth:a101 ldr x16, [x0, :tlsdesc_auth_lo12:a]102 add x0, x0, :tlsdesc_auth_lo12:a103 blraa x16, x0104 105 adrp x0, :tlsdesc:a106 ldr x1, [x0, :tlsdesc_lo12:a]107 add x0, x0, :tlsdesc_lo12:a108 blr x1109 110//--- err2.s111// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux -mattr=+pauth err2.s -o err2.o112// RUN: not ld.lld -shared err2.o 2>&1 | FileCheck --check-prefix=ERR2 --implicit-check-not=error: %s113// ERR2: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported114 .text115 adrp x0, :tlsdesc:a116 ldr x1, [x0, :tlsdesc_lo12:a]117 add x0, x0, :tlsdesc_lo12:a118 blr x1119 120 adrp x0, :tlsdesc_auth:a121 ldr x16, [x0, :tlsdesc_auth_lo12:a]122 add x0, x0, :tlsdesc_auth_lo12:a123 blraa x16, x0124 125//--- err3.s126// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux -mattr=+pauth err3.s -o err3.o127// RUN: not ld.lld -shared err3.o 2>&1 | FileCheck --check-prefix=ERR3 --implicit-check-not=error: %s128// ERR3: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported129 .text130 adrp x0, :tlsdesc_auth:a131 ldr x16, [x0, :tlsdesc_auth_lo12:a]132 add x0, x0, :tlsdesc_auth_lo12:a133 .tlsdesccall a134 blraa x16, x0135