https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/204226
>From ed37c72a50cbc61eaf083e30dde806a176549712 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Tue, 16 Jun 2026 21:43:12 +0300 Subject: [PATCH 1/8] [PAC][clang] Fix ptrauth module flags behavior The `Error` merge behavior only has effect when module flags values mismatch, while it allows the flag being present in one module and absent in another one. Always emit `ptrauth-elf-got` module flag for AArch64 targets and `ptrauth-sign-personality` module flag for AArch64 Linux targets. The value is either 0 or 1. --- clang/lib/CodeGen/CodeGenModule.cpp | 12 +++++++----- clang/test/CodeGen/ptrauth-module-flags.c | 12 ++++++++++-- clang/test/CodeGen/ubsan-function-sugared.cpp | 2 +- clang/test/CodeGen/ubsan-function.cpp | 2 +- clang/test/CodeGenCXX/pfp-memcpy.cpp | 4 ++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 41049d85121be..4d38fbdf20536 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1481,13 +1481,15 @@ void CodeGenModule::Release() { getModule().addModuleFlag(llvm::Module::Min, "sign-return-address-with-bkey", 2); - if (LangOpts.PointerAuthELFGOT) - getModule().addModuleFlag(llvm::Module::Error, "ptrauth-elf-got", 1); + getModule().addModuleFlag( + llvm::Module::Error, "ptrauth-elf-got", + static_cast<uint32_t>(LangOpts.PointerAuthELFGOT)); if (getTriple().isOSLinux()) { - if (LangOpts.PointerAuthCalls) - getModule().addModuleFlag(llvm::Module::Error, - "ptrauth-sign-personality", 1); + getModule().addModuleFlag( + llvm::Module::Error, "ptrauth-sign-personality", + static_cast<uint32_t>(LangOpts.PointerAuthCalls)); + assert(getTriple().isOSBinFormatELF()); using namespace llvm::ELF; uint64_t PAuthABIVersion = diff --git a/clang/test/CodeGen/ptrauth-module-flags.c b/clang/test/CodeGen/ptrauth-module-flags.c index 6c175c0aad781..ffe62ec25f655 100644 --- a/clang/test/CodeGen/ptrauth-module-flags.c +++ b/clang/test/CodeGen/ptrauth-module-flags.c @@ -4,10 +4,18 @@ // ELFGOT: !llvm.module.flags = !{ // ELFGOT-SAME: !0 +// ELFGOT-SAME: !1 // ELFGOT: !0 = !{i32 1, !"ptrauth-elf-got", i32 1} +// ELFGOT: !1 = !{i32 1, !"ptrauth-sign-personality", i32 0} // PERSONALITY: !llvm.module.flags = !{ // PERSONALITY-SAME: !0 -// PERSONALITY: !0 = !{i32 1, !"ptrauth-sign-personality", i32 1} +// PERSONALITY-SAME: !1 +// PERSONALITY: !0 = !{i32 1, !"ptrauth-elf-got", i32 0} +// PERSONALITY: !1 = !{i32 1, !"ptrauth-sign-personality", i32 1} -// OFF-NOT: "ptrauth- +// OFF: !llvm.module.flags = !{ +// OFF-SAME: !0 +// OFF-SAME: !1 +// OFF: !0 = !{i32 1, !"ptrauth-elf-got", i32 0} +// OFF: !1 = !{i32 1, !"ptrauth-sign-personality", i32 0} diff --git a/clang/test/CodeGen/ubsan-function-sugared.cpp b/clang/test/CodeGen/ubsan-function-sugared.cpp index 308edd8c0cd9b..2a6f8c81d7e0f 100644 --- a/clang/test/CodeGen/ubsan-function-sugared.cpp +++ b/clang/test/CodeGen/ubsan-function-sugared.cpp @@ -10,7 +10,7 @@ auto fun() {} // GNU-LABEL: define{{.*}} void @_Z6callerv() // MSVC-LABEL: define{{.*}} void @"?caller@@YAXXZ"() -// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize !5 +// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize // CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 0, !nosanitize // CHECK: load i32, ptr {{.*}}, align {{.*}}, !nosanitize // CHECK: icmp eq i32 {{.*}}, -1056584962, !nosanitize diff --git a/clang/test/CodeGen/ubsan-function.cpp b/clang/test/CodeGen/ubsan-function.cpp index 817a9cbefe690..cf419fa5b4753 100644 --- a/clang/test/CodeGen/ubsan-function.cpp +++ b/clang/test/CodeGen/ubsan-function.cpp @@ -13,7 +13,7 @@ void fun() {} // GNU-LABEL: define{{.*}} void @_Z6callerPFvvE(ptr noundef %f) // MSVC-LABEL: define{{.*}} void @"?caller@@YAXP6AXXZ@Z"(ptr noundef %f) -// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize !6 +// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize // AUTH: %[[STRIPPED:.*]] = ptrtoint ptr {{.*}} to i64, !nosanitize // AUTH: call i64 @llvm.ptrauth.auth(i64 %[[STRIPPED]], i32 0, i64 0), !nosanitize // CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 0, !nosanitize diff --git a/clang/test/CodeGenCXX/pfp-memcpy.cpp b/clang/test/CodeGenCXX/pfp-memcpy.cpp index be746fd8673a0..9621901c5c4c7 100644 --- a/clang/test/CodeGenCXX/pfp-memcpy.cpp +++ b/clang/test/CodeGenCXX/pfp-memcpy.cpp @@ -42,7 +42,7 @@ void trivial_copy(ClassWithTrivialCopy *s1) { // CHECK-NEXT: %a = getelementptr inbounds nuw %struct.ClassWithTrivialCopy, ptr %this1, i32 0, i32 0 // CHECK-NEXT: %1 = ptrtoint ptr %this1 to i64 // CHECK-NEXT: %2 = call ptr @llvm.protected.field.ptr.p0(ptr %a, i64 %1, i1 true) [ "deactivation-symbol"(ptr @__pfp_ds__ZTS20ClassWithTrivialCopy.a) ] -// CHECK-NEXT: %3 = load ptr, ptr %.addr, align 8, !nonnull !1, !align !2 +// CHECK-NEXT: %3 = load ptr, ptr %.addr, align 8, !nonnull ![[#]], !align ![[#]] // CHECK-NEXT: %a2 = getelementptr inbounds nuw %struct.ClassWithTrivialCopy, ptr %3, i32 0, i32 0 // CHECK-NEXT: %4 = ptrtoint ptr %3 to i64 // CHECK-NEXT: %5 = call ptr @llvm.protected.field.ptr.p0(ptr %a2, i64 %4, i1 true) [ "deactivation-symbol"(ptr @__pfp_ds__ZTS20ClassWithTrivialCopy.a) ] @@ -51,7 +51,7 @@ void trivial_copy(ClassWithTrivialCopy *s1) { // CHECK-NEXT: %c = getelementptr inbounds nuw %struct.ClassWithTrivialCopy, ptr %this1, i32 0, i32 1 // CHECK-NEXT: %7 = ptrtoint ptr %this1 to i64 // CHECK-NEXT: %8 = call ptr @llvm.protected.field.ptr.p0(ptr %c, i64 %7, i1 true) [ "deactivation-symbol"(ptr @__pfp_ds__ZTS20ClassWithTrivialCopy.c) ] -// CHECK-NEXT: %9 = load ptr, ptr %.addr, align 8, !nonnull !1, !align !2 +// CHECK-NEXT: %9 = load ptr, ptr %.addr, align 8, !nonnull ![[#]], !align ![[#]] // CHECK-NEXT: %c3 = getelementptr inbounds nuw %struct.ClassWithTrivialCopy, ptr %9, i32 0, i32 1 // CHECK-NEXT: %10 = ptrtoint ptr %9 to i64 // CHECK-NEXT: %11 = call ptr @llvm.protected.field.ptr.p0(ptr %c3, i64 %10, i1 true) [ "deactivation-symbol"(ptr @__pfp_ds__ZTS20ClassWithTrivialCopy.c) ] >From ba1154796fb6e3374f06c4bc2d5c6c16810ce2bb Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Thu, 18 Jun 2026 20:07:32 +0300 Subject: [PATCH 2/8] Address review comments --- clang/lib/CodeGen/CodeGenModule.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4d38fbdf20536..2942687bd37a0 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1480,7 +1480,8 @@ void CodeGenModule::Release() { if (!LangOpts.isSignReturnAddressWithAKey()) getModule().addModuleFlag(llvm::Module::Min, "sign-return-address-with-bkey", 2); - + } + if (T.isAArch64()) { getModule().addModuleFlag( llvm::Module::Error, "ptrauth-elf-got", static_cast<uint32_t>(LangOpts.PointerAuthELFGOT)); @@ -1520,14 +1521,12 @@ void CodeGenModule::Release() { static_assert(AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_FPTRTYPEDISCR == AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_LAST, "Update when new enum items are defined"); - if (PAuthABIVersion != 0) { - getModule().addModuleFlag(llvm::Module::Error, - "aarch64-elf-pauthabi-platform", - AARCH64_PAUTH_PLATFORM_LLVM_LINUX); - getModule().addModuleFlag(llvm::Module::Error, - "aarch64-elf-pauthabi-version", - PAuthABIVersion); - } + + getModule().addModuleFlag(llvm::Module::Error, + "aarch64-elf-pauthabi-platform", + AARCH64_PAUTH_PLATFORM_LLVM_LINUX); + getModule().addModuleFlag( + llvm::Module::Error, "aarch64-elf-pauthabi-version", PAuthABIVersion); } } if ((T.isARM() || T.isThumb()) && getTriple().isTargetAEABI() && >From 2626bf63c82e310749948cc9354c2630cda53e8f Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Wed, 1 Jul 2026 15:31:45 +0300 Subject: [PATCH 3/8] Address review comments --- clang/lib/CodeGen/CodeGenModule.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 1e8ebc435c4c2..27d11d74d8c21 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1483,9 +1483,10 @@ void CodeGenModule::Release() { "sign-return-address-with-bkey", 2); } if (T.isAArch64()) { - getModule().addModuleFlag( - llvm::Module::Error, "ptrauth-elf-got", - static_cast<uint32_t>(LangOpts.PointerAuthELFGOT)); + if (getTriple().isOSBinFormatELF()) + getModule().addModuleFlag( + llvm::Module::Error, "ptrauth-elf-got", + static_cast<uint32_t>(LangOpts.PointerAuthELFGOT)); if (getTriple().isOSLinux()) { getModule().addModuleFlag( >From 309be5aad918002cfcfdbc677ceafb7341c52e5f Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Mon, 6 Jul 2026 17:09:06 +0300 Subject: [PATCH 4/8] Address review comments --- clang/lib/CodeGen/CodeGenModule.cpp | 10 +++---- clang/test/CodeGen/ubsan-function-sugared.cpp | 2 +- clang/test/CodeGen/ubsan-function.cpp | 2 +- .../CodeGen/AArch64/arm64-tls-dynamics.ll | 17 +++++++++++ llvm/test/CodeGen/AArch64/basic-pic.ll | 9 ++++++ llvm/test/CodeGen/AArch64/elf-globals-pic.ll | 11 ++++++++ llvm/test/CodeGen/AArch64/extern-weak.ll | 13 +++++++++ llvm/test/CodeGen/AArch64/got-abuse.ll | 10 +++++++ .../ptrauth-elf-got-function-symbols.ll | 28 +++++++++++++++++-- .../CodeGen/AArch64/tagged-globals-pic.ll | 12 ++++++++ llvm/test/CodeGen/AArch64/tiny-model-pic.ll | 12 ++++++++ .../test/CodeGen/AArch64/tiny-model-static.ll | 13 +++++++++ 12 files changed, 128 insertions(+), 11 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 27d11d74d8c21..05554d2815a55 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1484,14 +1484,12 @@ void CodeGenModule::Release() { } if (T.isAArch64()) { if (getTriple().isOSBinFormatELF()) - getModule().addModuleFlag( - llvm::Module::Error, "ptrauth-elf-got", - static_cast<uint32_t>(LangOpts.PointerAuthELFGOT)); + getModule().addModuleFlag(llvm::Module::Error, "ptrauth-elf-got", + LangOpts.PointerAuthELFGOT); if (getTriple().isOSLinux()) { - getModule().addModuleFlag( - llvm::Module::Error, "ptrauth-sign-personality", - static_cast<uint32_t>(LangOpts.PointerAuthCalls)); + getModule().addModuleFlag(llvm::Module::Error, "ptrauth-sign-personality", + LangOpts.PointerAuthCalls); assert(getTriple().isOSBinFormatELF()); using namespace llvm::ELF; diff --git a/clang/test/CodeGen/ubsan-function-sugared.cpp b/clang/test/CodeGen/ubsan-function-sugared.cpp index 2a6f8c81d7e0f..308edd8c0cd9b 100644 --- a/clang/test/CodeGen/ubsan-function-sugared.cpp +++ b/clang/test/CodeGen/ubsan-function-sugared.cpp @@ -10,7 +10,7 @@ auto fun() {} // GNU-LABEL: define{{.*}} void @_Z6callerv() // MSVC-LABEL: define{{.*}} void @"?caller@@YAXXZ"() -// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize +// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize !5 // CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 0, !nosanitize // CHECK: load i32, ptr {{.*}}, align {{.*}}, !nosanitize // CHECK: icmp eq i32 {{.*}}, -1056584962, !nosanitize diff --git a/clang/test/CodeGen/ubsan-function.cpp b/clang/test/CodeGen/ubsan-function.cpp index cf419fa5b4753..817a9cbefe690 100644 --- a/clang/test/CodeGen/ubsan-function.cpp +++ b/clang/test/CodeGen/ubsan-function.cpp @@ -13,7 +13,7 @@ void fun() {} // GNU-LABEL: define{{.*}} void @_Z6callerPFvvE(ptr noundef %f) // MSVC-LABEL: define{{.*}} void @"?caller@@YAXP6AXXZ@Z"(ptr noundef %f) -// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize +// ARM: call ptr @llvm.ptrmask.p0.i32(ptr {{.*}}, i32 -2), !nosanitize !6 // AUTH: %[[STRIPPED:.*]] = ptrtoint ptr {{.*}} to i64, !nosanitize // AUTH: call i64 @llvm.ptrauth.auth(i64 %[[STRIPPED]], i32 0, i64 0), !nosanitize // CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 0, !nosanitize diff --git a/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll b/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll index c12730bd3b0d7..81051d94cda70 100644 --- a/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll +++ b/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll @@ -1,18 +1,30 @@ ; Verify the call site info. If the call site info is not ; in the valid state, an assert should be triggered. + +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc < %s -debug-entry-values -mtriple=arm64-none-linux-gnu -stop-after=machineverifier -relocation-model=pic -aarch64-elf-ldtls-generation=1 < %s +; RUN: llc < src.ll -debug-entry-values -mtriple=arm64-none-linux-gnu -stop-after=machineverifier -relocation-model=pic -aarch64-elf-ldtls-generation=1 < %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -verify-machineinstrs < %s | FileCheck %s +; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -verify-machineinstrs < src.ll | FileCheck %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s +; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -filetype=obj < src.ll | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-NOLD %s +; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -verify-machineinstrs < src.ll | FileCheck --check-prefix=CHECK-NOLD %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-NOLD-RELOC %s +; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -filetype=obj < src.ll | llvm-objdump -r - | FileCheck --check-prefix=CHECK-NOLD-RELOC %s ; FIXME: We currently produce "small" code for the tiny model ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=tiny -verify-machineinstrs < %s | FileCheck %s +; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=tiny -verify-machineinstrs < src.ll | FileCheck %s ; FIXME: We currently error for the large code model ; RUN: not --crash llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=large -verify-machineinstrs < %s 2>&1 | FileCheck %s --check-prefix=CHECK-LARGE +; RUN: not --crash llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=large -verify-machineinstrs < src.ll 2>&1 | FileCheck %s --check-prefix=CHECK-LARGE ; CHECK-LARGE: ELF TLS only supported in small memory model +;--- src.ll + @general_dynamic_var = external thread_local global i32 define i32 @test_generaldynamic() { @@ -177,3 +189,8 @@ define i32 @test_localdynamic_deduplicate() { ; CHECK: ret } + +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/basic-pic.ll b/llvm/test/CodeGen/AArch64/basic-pic.ll index 8ef48d5a9c8ad..c94d3ee386fae 100644 --- a/llvm/test/CodeGen/AArch64/basic-pic.ll +++ b/llvm/test/CodeGen/AArch64/basic-pic.ll @@ -1,4 +1,8 @@ +; RUN: rm -rf %t && split-file %s %t && cd %t ; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s +; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic src.ll -o - | FileCheck %s + +;--- src.ll @var = global i32 0 @@ -20,3 +24,8 @@ define ptr @get_globalvaraddr() { %val = load i32, ptr @var ret ptr @var } + +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/elf-globals-pic.ll b/llvm/test/CodeGen/AArch64/elf-globals-pic.ll index d0df0bbea07c2..8fe84b70c2005 100644 --- a/llvm/test/CodeGen/AArch64/elf-globals-pic.ll +++ b/llvm/test/CodeGen/AArch64/elf-globals-pic.ll @@ -1,5 +1,11 @@ +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc -mtriple=arm64 -relocation-model=pic -o - %s -mcpu=cyclone | FileCheck %s --check-prefix=CHECK +; RUN: llc -mtriple=arm64 -relocation-model=pic -o - src.ll -mcpu=cyclone | FileCheck %s --check-prefix=CHECK ; RUN: llc -mtriple=arm64 -O0 -fast-isel -relocation-model=pic -o - %s -mcpu=cyclone | FileCheck %s --check-prefix=CHECK-FAST +; RUN: llc -mtriple=arm64 -O0 -fast-isel -relocation-model=pic -o - src.ll -mcpu=cyclone | FileCheck %s --check-prefix=CHECK-FAST + +;--- src.ll @var8 = external global i8, align 1 @var16 = external global i16, align 2 @@ -68,3 +74,8 @@ define i64 @test_default_unaligned() { %val = load i64, ptr @var_default ret i64 %val } + +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/extern-weak.ll b/llvm/test/CodeGen/AArch64/extern-weak.ll index b0e675c084848..19d5f1e18ce41 100644 --- a/llvm/test/CodeGen/AArch64/extern-weak.ll +++ b/llvm/test/CodeGen/AArch64/extern-weak.ll @@ -1,7 +1,15 @@ +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - %s | FileCheck %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - src.ll | FileCheck %s ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=static -o - < %s | FileCheck %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=static -o - < src.ll | FileCheck %s ; RUN: llc -mtriple=aarch64-none-linux-gnu -code-model=large -o - %s | FileCheck --check-prefix=CHECK-LARGE %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -code-model=large -o - src.ll | FileCheck --check-prefix=CHECK-LARGE %s ; RUN: llc -mtriple=aarch64-none-elf -code-model=tiny -o - %s | FileCheck --check-prefix=CHECK-TINY %s +; RUN: llc -mtriple=aarch64-none-elf -code-model=tiny -o - src.ll | FileCheck --check-prefix=CHECK-TINY %s + +;--- src.ll declare extern_weak dso_local i32 @var() @@ -61,3 +69,8 @@ define ptr @wibble() { ; CHECK-TINY: adr x0, defined_weak_var } + +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/got-abuse.ll b/llvm/test/CodeGen/AArch64/got-abuse.ll index 0b682d95db21a..13ebe9c512683 100644 --- a/llvm/test/CodeGen/AArch64/got-abuse.ll +++ b/llvm/test/CodeGen/AArch64/got-abuse.ll @@ -1,5 +1,9 @@ +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - %s | FileCheck %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - src.ll | FileCheck %s ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -filetype=obj -o - %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -filetype=obj -o - src.ll ; LLVM gives well-defined semantics to this horrible construct (though C says ; it's undefined). Regardless, we shouldn't crash. The important feature here is @@ -9,6 +13,8 @@ ; + ldr wD, [xN, #:got_lo12:func] ; + add xD, xN, #:got_lo12:func +;--- src.ll + declare void @consume(i32) declare void @func() @@ -21,3 +27,7 @@ entry: ret void } +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll b/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll index e75acceaa0d12..bc74781693879 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll @@ -1,8 +1,18 @@ -; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm %s -o - | \ +; RUN: rm -rf %t && split-file %s %t && cd %t +; RUN: cat common.ll elf-got-flag-1.ll > auth.ll +; RUN: cat common.ll elf-got-flag-0.ll > noauth1.ll +; RUN: cat common.ll > noauth2.ll + +; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm auth.ll -o - | \ ; RUN: FileCheck %s --check-prefix=ASM -; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=obj %s -o - | \ +; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=obj auth.ll -o - | \ ; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth1.ll -o - | \ +; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth2.ll -o - | \ +; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH + ; ASM: .type foo,@function ; ASM-LABEL: foo: ; ASM: adrp x17, :got_auth:bar @@ -28,6 +38,12 @@ ; OBJ-NEXT: Num: Value Size Type Bind Vis Ndx Name ; OBJ: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bar +; OBJ-NOAUTH: Symbol table '.symtab' contains [[#]] entries: +; OBJ-NOAUTH-NEXT: Num: Value Size Type Bind Vis Ndx Name +; OBJ-NOAUTH: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar + +;--- common.ll + @fptr = private global ptr null define void @foo() { @@ -37,6 +53,12 @@ define void @foo() { declare i32 @bar() -!llvm.module.flags = !{!0} +;--- elf-got-flag-1.ll +!llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 1} + +;--- elf-got-flag-0.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll b/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll index 3e3619834fbbc..a2617582c5300 100644 --- a/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll +++ b/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll @@ -1,4 +1,7 @@ +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc --relocation-model=pic < %s | FileCheck %s +; RUN: llc --relocation-model=pic < src.ll | FileCheck %s ; Ensure that GlobalISel lowers correctly. GlobalISel is the default ISel for ; -O0 on aarch64. GlobalISel lowers the instruction sequence in the static @@ -13,6 +16,10 @@ ; RUN: llc --aarch64-enable-global-isel-at-O=0 -O0 --relocation-model=pic < %s \ ; RUN: | FileCheck %s +; RUN: llc --aarch64-enable-global-isel-at-O=0 -O0 --relocation-model=pic < \ +; RUN: src.ll | FileCheck %s + +;--- src.ll target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" target triple = "aarch64-unknown-linux-android" @@ -61,3 +68,8 @@ define ptr @func_addr() #0 { } attributes #0 = { "target-features"="+tagged-globals" } + +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/tiny-model-pic.ll b/llvm/test/CodeGen/AArch64/tiny-model-pic.ll index 3868303a9fb70..28f7591f113d1 100644 --- a/llvm/test/CodeGen/AArch64/tiny-model-pic.ll +++ b/llvm/test/CodeGen/AArch64/tiny-model-pic.ll @@ -1,10 +1,18 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py + +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic < %s | FileCheck %s --check-prefix=CHECK-PIC +; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic < src.ll | FileCheck %s --check-prefix=CHECK-PIC ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -fast-isel < %s | FileCheck %s --check-prefix=CHECK-PIC +; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -fast-isel < src.ll | FileCheck %s --check-prefix=CHECK-PIC ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -global-isel < %s | FileCheck %s --check-prefix=CHECK-PIC-GLOBISEL +; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -global-isel < src.ll | FileCheck %s --check-prefix=CHECK-PIC-GLOBISEL ; Note fast-isel tests here will fall back to isel +;--- src.ll + @src = external local_unnamed_addr global [65536 x i8], align 1 @dst = external global [65536 x i8], align 1 @ptr = external local_unnamed_addr global ptr, align 8 @@ -250,3 +258,7 @@ entry: ret ptr @externfuncaddr } +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/tiny-model-static.ll b/llvm/test/CodeGen/AArch64/tiny-model-static.ll index 311ea9a31ab6a..2987da70aa7fe 100644 --- a/llvm/test/CodeGen/AArch64/tiny-model-static.ll +++ b/llvm/test/CodeGen/AArch64/tiny-model-static.ll @@ -1,7 +1,15 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py + +; RUN: rm -rf %t && split-file %s %t && cd %t + ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny < %s | FileCheck %s --check-prefix=CHECK --check-prefix=SDISEL +; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny < src.ll | FileCheck %s --check-prefix=CHECK --check-prefix=SDISEL ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -fast-isel < %s | FileCheck %s --check-prefix=CHECK --check-prefix=FAST +; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -fast-isel < src.ll | FileCheck %s --check-prefix=CHECK --check-prefix=FAST ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -global-isel < %s | FileCheck %s --check-prefix=CHECK-GLOBISEL +; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -global-isel < src.ll | FileCheck %s --check-prefix=CHECK-GLOBISEL + +;--- src.ll ; Note fast-isel tests here will fall back to isel @@ -326,3 +334,8 @@ define dso_local void @stackprot(ptr %callee) sspstrong { call void %callee(ptr %arr) ret void } + +;--- elf-got-flag.ll + +!llvm.module.flags = !{!0} +!0 = !{i32 8, !"ptrauth-elf-got", i32 0} >From 8975a683e02c08767f9c088fedce6b398fcbf312 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Thu, 9 Jul 2026 01:07:14 +0300 Subject: [PATCH 5/8] Do not clutter tests with split-file logic --- llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll | 14 -------------- llvm/test/CodeGen/AArch64/basic-pic.ll | 6 ------ llvm/test/CodeGen/AArch64/elf-globals-pic.ll | 8 -------- llvm/test/CodeGen/AArch64/extern-weak.ll | 10 ---------- llvm/test/CodeGen/AArch64/got-abuse.ll | 8 -------- llvm/test/CodeGen/AArch64/tagged-globals-pic.ll | 9 --------- llvm/test/CodeGen/AArch64/tiny-model-pic.ll | 10 ---------- llvm/test/CodeGen/AArch64/tiny-model-static.ll | 10 ---------- 8 files changed, 75 deletions(-) diff --git a/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll b/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll index 81051d94cda70..098d6a29c2390 100644 --- a/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll +++ b/llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll @@ -1,30 +1,18 @@ ; Verify the call site info. If the call site info is not ; in the valid state, an assert should be triggered. - -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc < %s -debug-entry-values -mtriple=arm64-none-linux-gnu -stop-after=machineverifier -relocation-model=pic -aarch64-elf-ldtls-generation=1 < %s -; RUN: llc < src.ll -debug-entry-values -mtriple=arm64-none-linux-gnu -stop-after=machineverifier -relocation-model=pic -aarch64-elf-ldtls-generation=1 < %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -verify-machineinstrs < %s | FileCheck %s -; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -verify-machineinstrs < src.ll | FileCheck %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s -; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -filetype=obj < src.ll | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-NOLD %s -; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -verify-machineinstrs < src.ll | FileCheck --check-prefix=CHECK-NOLD %s ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-NOLD-RELOC %s -; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -filetype=obj < src.ll | llvm-objdump -r - | FileCheck --check-prefix=CHECK-NOLD-RELOC %s ; FIXME: We currently produce "small" code for the tiny model ; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=tiny -verify-machineinstrs < %s | FileCheck %s -; RUN: llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=tiny -verify-machineinstrs < src.ll | FileCheck %s ; FIXME: We currently error for the large code model ; RUN: not --crash llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=large -verify-machineinstrs < %s 2>&1 | FileCheck %s --check-prefix=CHECK-LARGE -; RUN: not --crash llc -mtriple=arm64-none-linux-gnu -relocation-model=pic -aarch64-elf-ldtls-generation=1 -code-model=large -verify-machineinstrs < src.ll 2>&1 | FileCheck %s --check-prefix=CHECK-LARGE ; CHECK-LARGE: ELF TLS only supported in small memory model -;--- src.ll - @general_dynamic_var = external thread_local global i32 define i32 @test_generaldynamic() { @@ -190,7 +178,5 @@ define i32 @test_localdynamic_deduplicate() { ; CHECK: ret } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/basic-pic.ll b/llvm/test/CodeGen/AArch64/basic-pic.ll index c94d3ee386fae..44eb7a5c07a51 100644 --- a/llvm/test/CodeGen/AArch64/basic-pic.ll +++ b/llvm/test/CodeGen/AArch64/basic-pic.ll @@ -1,8 +1,4 @@ -; RUN: rm -rf %t && split-file %s %t && cd %t ; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s -; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic src.ll -o - | FileCheck %s - -;--- src.ll @var = global i32 0 @@ -25,7 +21,5 @@ define ptr @get_globalvaraddr() { ret ptr @var } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/elf-globals-pic.ll b/llvm/test/CodeGen/AArch64/elf-globals-pic.ll index 8fe84b70c2005..a2e91e26c71a6 100644 --- a/llvm/test/CodeGen/AArch64/elf-globals-pic.ll +++ b/llvm/test/CodeGen/AArch64/elf-globals-pic.ll @@ -1,11 +1,5 @@ -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc -mtriple=arm64 -relocation-model=pic -o - %s -mcpu=cyclone | FileCheck %s --check-prefix=CHECK -; RUN: llc -mtriple=arm64 -relocation-model=pic -o - src.ll -mcpu=cyclone | FileCheck %s --check-prefix=CHECK ; RUN: llc -mtriple=arm64 -O0 -fast-isel -relocation-model=pic -o - %s -mcpu=cyclone | FileCheck %s --check-prefix=CHECK-FAST -; RUN: llc -mtriple=arm64 -O0 -fast-isel -relocation-model=pic -o - src.ll -mcpu=cyclone | FileCheck %s --check-prefix=CHECK-FAST - -;--- src.ll @var8 = external global i8, align 1 @var16 = external global i16, align 2 @@ -75,7 +69,5 @@ define i64 @test_default_unaligned() { ret i64 %val } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/extern-weak.ll b/llvm/test/CodeGen/AArch64/extern-weak.ll index 19d5f1e18ce41..7db660b1f7d81 100644 --- a/llvm/test/CodeGen/AArch64/extern-weak.ll +++ b/llvm/test/CodeGen/AArch64/extern-weak.ll @@ -1,15 +1,7 @@ -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - %s | FileCheck %s -; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - src.ll | FileCheck %s ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=static -o - < %s | FileCheck %s -; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=static -o - < src.ll | FileCheck %s ; RUN: llc -mtriple=aarch64-none-linux-gnu -code-model=large -o - %s | FileCheck --check-prefix=CHECK-LARGE %s -; RUN: llc -mtriple=aarch64-none-linux-gnu -code-model=large -o - src.ll | FileCheck --check-prefix=CHECK-LARGE %s ; RUN: llc -mtriple=aarch64-none-elf -code-model=tiny -o - %s | FileCheck --check-prefix=CHECK-TINY %s -; RUN: llc -mtriple=aarch64-none-elf -code-model=tiny -o - src.ll | FileCheck --check-prefix=CHECK-TINY %s - -;--- src.ll declare extern_weak dso_local i32 @var() @@ -70,7 +62,5 @@ define ptr @wibble() { ; CHECK-TINY: adr x0, defined_weak_var } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/got-abuse.ll b/llvm/test/CodeGen/AArch64/got-abuse.ll index 13ebe9c512683..4fa74cadac521 100644 --- a/llvm/test/CodeGen/AArch64/got-abuse.ll +++ b/llvm/test/CodeGen/AArch64/got-abuse.ll @@ -1,9 +1,5 @@ -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - %s | FileCheck %s -; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -o - src.ll | FileCheck %s ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -filetype=obj -o - %s -; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -filetype=obj -o - src.ll ; LLVM gives well-defined semantics to this horrible construct (though C says ; it's undefined). Regardless, we shouldn't crash. The important feature here is @@ -13,8 +9,6 @@ ; + ldr wD, [xN, #:got_lo12:func] ; + add xD, xN, #:got_lo12:func -;--- src.ll - declare void @consume(i32) declare void @func() @@ -27,7 +21,5 @@ entry: ret void } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll b/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll index a2617582c5300..82298a1429328 100644 --- a/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll +++ b/llvm/test/CodeGen/AArch64/tagged-globals-pic.ll @@ -1,7 +1,4 @@ -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc --relocation-model=pic < %s | FileCheck %s -; RUN: llc --relocation-model=pic < src.ll | FileCheck %s ; Ensure that GlobalISel lowers correctly. GlobalISel is the default ISel for ; -O0 on aarch64. GlobalISel lowers the instruction sequence in the static @@ -16,10 +13,6 @@ ; RUN: llc --aarch64-enable-global-isel-at-O=0 -O0 --relocation-model=pic < %s \ ; RUN: | FileCheck %s -; RUN: llc --aarch64-enable-global-isel-at-O=0 -O0 --relocation-model=pic < \ -; RUN: src.ll | FileCheck %s - -;--- src.ll target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" target triple = "aarch64-unknown-linux-android" @@ -69,7 +62,5 @@ define ptr @func_addr() #0 { attributes #0 = { "target-features"="+tagged-globals" } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/tiny-model-pic.ll b/llvm/test/CodeGen/AArch64/tiny-model-pic.ll index 28f7591f113d1..964981d6bdcb9 100644 --- a/llvm/test/CodeGen/AArch64/tiny-model-pic.ll +++ b/llvm/test/CodeGen/AArch64/tiny-model-pic.ll @@ -1,18 +1,10 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py - -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic < %s | FileCheck %s --check-prefix=CHECK-PIC -; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic < src.ll | FileCheck %s --check-prefix=CHECK-PIC ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -fast-isel < %s | FileCheck %s --check-prefix=CHECK-PIC -; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -fast-isel < src.ll | FileCheck %s --check-prefix=CHECK-PIC ; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -global-isel < %s | FileCheck %s --check-prefix=CHECK-PIC-GLOBISEL -; RUN: llc -verify-machineinstrs -mtriple=aarch64 -code-model=tiny -relocation-model=pic -global-isel < src.ll | FileCheck %s --check-prefix=CHECK-PIC-GLOBISEL ; Note fast-isel tests here will fall back to isel -;--- src.ll - @src = external local_unnamed_addr global [65536 x i8], align 1 @dst = external global [65536 x i8], align 1 @ptr = external local_unnamed_addr global ptr, align 8 @@ -258,7 +250,5 @@ entry: ret ptr @externfuncaddr } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} diff --git a/llvm/test/CodeGen/AArch64/tiny-model-static.ll b/llvm/test/CodeGen/AArch64/tiny-model-static.ll index 2987da70aa7fe..8b9b45bbf9c15 100644 --- a/llvm/test/CodeGen/AArch64/tiny-model-static.ll +++ b/llvm/test/CodeGen/AArch64/tiny-model-static.ll @@ -1,15 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py - -; RUN: rm -rf %t && split-file %s %t && cd %t - ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny < %s | FileCheck %s --check-prefix=CHECK --check-prefix=SDISEL -; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny < src.ll | FileCheck %s --check-prefix=CHECK --check-prefix=SDISEL ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -fast-isel < %s | FileCheck %s --check-prefix=CHECK --check-prefix=FAST -; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -fast-isel < src.ll | FileCheck %s --check-prefix=CHECK --check-prefix=FAST ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -global-isel < %s | FileCheck %s --check-prefix=CHECK-GLOBISEL -; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -global-isel < src.ll | FileCheck %s --check-prefix=CHECK-GLOBISEL - -;--- src.ll ; Note fast-isel tests here will fall back to isel @@ -335,7 +327,5 @@ define dso_local void @stackprot(ptr %callee) sspstrong { ret void } -;--- elf-got-flag.ll - !llvm.module.flags = !{!0} !0 = !{i32 8, !"ptrauth-elf-got", i32 0} >From 3b0e6e430865715e0cc0afb157b7117e9a01f3bc Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Thu, 9 Jul 2026 01:25:07 +0300 Subject: [PATCH 6/8] Add missing test case of version = 0 --- clang/test/CodeGen/AArch64/elf-pauthabi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clang/test/CodeGen/AArch64/elf-pauthabi.c b/clang/test/CodeGen/AArch64/elf-pauthabi.c index b176f708db85b..155c0dc0120d5 100644 --- a/clang/test/CodeGen/AArch64/elf-pauthabi.c +++ b/clang/test/CodeGen/AArch64/elf-pauthabi.c @@ -13,6 +13,9 @@ // RUN: -fptrauth-function-pointer-type-discrimination %s | \ // RUN: FileCheck %s --check-prefix=ALL +// RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ +// RUN: %s | FileCheck %s --check-prefix=NONE + // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ // RUN: -fptrauth-intrinsics %s | FileCheck %s --check-prefix=INTRIN @@ -58,6 +61,9 @@ // ALL: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} // ALL: !{i32 1, !"aarch64-elf-pauthabi-version", i32 4095} +// NONE: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} +// NONE: !{i32 1, !"aarch64-elf-pauthabi-version", i32 0} + // INTRIN: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} // INTRIN: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1} >From 00fa7ea2a98d8595bbe2727591a2297b265d2889 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Fri, 10 Jul 2026 17:18:34 +0300 Subject: [PATCH 7/8] Address review comments --- clang/lib/CodeGen/CodeGenModule.cpp | 3 + llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 10 +++ .../AArch64/build-attributes-pauthabi.ll | 80 +++++++++++++++++-- .../AArch64/note-gnu-property-elf-pauthabi.ll | 30 +++++-- .../ptrauth-elf-got-function-symbols.ll | 29 +++++-- 5 files changed, 133 insertions(+), 19 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 6744d300dc729..7963e377b88bd 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1577,6 +1577,9 @@ void CodeGenModule::Release() { AARCH64_PAUTH_PLATFORM_LLVM_LINUX_VERSION_LAST, "Update when new enum items are defined"); + // Always emit the aarch64-elf-pauthabi-{platform|version} flags even if + // the version value is 0 to guard against incorrect module merge + // behavior. getModule().addModuleFlag(llvm::Module::Error, "aarch64-elf-pauthabi-platform", AARCH64_PAUTH_PLATFORM_LLVM_LINUX); diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index 07c983efd619a..2fbe1f921e2b1 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -455,6 +455,16 @@ void AArch64AsmPrinter::emitStartOfAsmFile(Module &M) { PAuthABIVersion = PAV->getZExtValue(); } + // For LLVM_LINUX experimental platform, version value of 0 means no PAuth + // support. Do not emit corresponding PAuthABI GNU property note and AArch64 + // build attributes for this case to keep Linux binaries not using PAuth + // unaffected. + if (PAuthABIPlatform == ELF::AARCH64_PAUTH_PLATFORM_LLVM_LINUX && + PAuthABIVersion == 0) { + PAuthABIPlatform = uint64_t(-1); + PAuthABIVersion = uint64_t(-1); + } + // Emit AArch64 Build Attributes emitAttributes(BAFlags, PAuthABIPlatform, PAuthABIVersion, TS); // Emit a .note.gnu.property section with the flags. diff --git a/llvm/test/CodeGen/AArch64/build-attributes-pauthabi.ll b/llvm/test/CodeGen/AArch64/build-attributes-pauthabi.ll index 1c2a72524d5de..1a9d1394b444c 100644 --- a/llvm/test/CodeGen/AArch64/build-attributes-pauthabi.ll +++ b/llvm/test/CodeGen/AArch64/build-attributes-pauthabi.ll @@ -1,18 +1,82 @@ -; RUN: llc < %s | FileCheck %s --check-prefix=ASM -; RUN: llc %s -filetype=obj -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF +; RUN: rm -rf %t && split-file %s %t && cd %t -; ASM: .aeabi_subsection aeabi_pauthabi, required, uleb128 -; ASM-NEXT: .aeabi_attribute 1, 2 // Tag_PAuth_Platform -; ASM-NEXT: .aeabi_attribute 2, 31 // Tag_PAuth_Schema +;--- platform-2-version-31.ll -; ELF: Hex dump of section '.ARM.attributes': -; ELF-NEXT: 0x00000000 41190000 00616561 62695f70 61757468 A....aeabi_pauth -; ELF-NEXT: 0x00000010 61626900 00000102 021f +; RUN: llc < platform-2-version-31.ll | FileCheck %s --check-prefix=ASM-2-31 +; RUN: llc platform-2-version-31.ll -filetype=obj -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF-2-31 +; ASM-2-31: .aeabi_subsection aeabi_pauthabi, required, uleb128 +; ASM-2-31-NEXT: .aeabi_attribute 1, 2 // Tag_PAuth_Platform +; ASM-2-31-NEXT: .aeabi_attribute 2, 31 // Tag_PAuth_Schema + +; ELF-2-31: Hex dump of section '.ARM.attributes': +; ELF-2-31-NEXT: 0x00000000 41190000 00616561 62695f70 61757468 A....aeabi_pauth +; ELF-2-31-NEXT: 0x00000010 61626900 00000102 021f + +target triple = "aarch64-unknown-none-elf" + +!llvm.module.flags = !{!1, !2} + +!1 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 2} +!2 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 31} + + +;--- platform-2-version-0.ll + +; RUN: llc < platform-2-version-0.ll | FileCheck %s --check-prefix=ASM-2-0 +; RUN: llc platform-2-version-0.ll -filetype=obj -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF-2-0 + +; ASM-2-0: .aeabi_subsection aeabi_pauthabi, required, uleb128 +; ASM-2-0-NEXT: .aeabi_attribute 1, 2 // Tag_PAuth_Platform +; ASM-2-0-NEXT: .aeabi_attribute 2, 0 // Tag_PAuth_Schema + +; ELF-2-0: Hex dump of section '.ARM.attributes': +; ELF-2-0-NEXT: 0x00000000 41190000 00616561 62695f70 61757468 A....aeabi_pauth +; ELF-2-0-NEXT: 0x00000010 61626900 00000102 0200 target triple = "aarch64-unknown-none-elf" !llvm.module.flags = !{!1, !2} !1 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 2} +!2 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 0} + + +;--- platform-llvm_linux-version-31.ll + +; RUN: llc < platform-llvm_linux-version-31.ll | FileCheck %s --check-prefix=ASM-LLVM_LINUX-31 +; RUN: llc platform-llvm_linux-version-31.ll -filetype=obj -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF-LLVM_LINUX-31 + +; ASM-LLVM_LINUX-31: .aeabi_subsection aeabi_pauthabi, required, uleb128 +; ASM-LLVM_LINUX-31-NEXT: .aeabi_attribute 1, 268435458 // Tag_PAuth_Platform +; ASM-LLVM_LINUX-31-NEXT: .aeabi_attribute 2, 31 // Tag_PAuth_Schema + +; ELF-LLVM_LINUX-31: Hex dump of section '.ARM.attributes': +; ELF-LLVM_LINUX-31-NEXT: 0x00000000 411d0000 00616561 62695f70 61757468 A....aeabi_pauth +; ELF-LLVM_LINUX-31-NEXT: 0x00000010 61626900 00000182 80808001 021f +target triple = "aarch64-unknown-none-elf" + +!llvm.module.flags = !{!1, !2} + +!1 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} !2 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 31} + + +;--- platform-llvm_linux-version-0.ll + +; For LLVM_LINUX experimental platform, version value of 0 means no PAuth support. +; Do not emit corresponding PAuthABI GNU property note and AArch64 build attributes +; for this case to keep Linux binaries not using PAuth unaffected. + +; RUN: llc < platform-llvm_linux-version-0.ll | FileCheck %s --check-prefix=ASM-LLVM_LINUX-0 +; RUN: llc platform-llvm_linux-version-0.ll -filetype=obj -o - | llvm-readelf --sections - | FileCheck %s --check-prefix=ELF-LLVM_LINUX-0 + +; ASM-LLVM_LINUX-0-NOT: aeabi_pauthabi +; ELF-LLVM_LINUX-0-NOT: .ARM.attributes + +target triple = "aarch64-unknown-none-elf" + +!llvm.module.flags = !{!1, !2} + +!1 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} +!2 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 0} diff --git a/llvm/test/CodeGen/AArch64/note-gnu-property-elf-pauthabi.ll b/llvm/test/CodeGen/AArch64/note-gnu-property-elf-pauthabi.ll index e5f675e62577d..bb919f99170d4 100644 --- a/llvm/test/CodeGen/AArch64/note-gnu-property-elf-pauthabi.ll +++ b/llvm/test/CodeGen/AArch64/note-gnu-property-elf-pauthabi.ll @@ -1,5 +1,7 @@ ; RUN: rm -rf %t && split-file %s %t && cd %t +; ERR: either both or no 'aarch64-elf-pauthabi-platform' and 'aarch64-elf-pauthabi-version' module flags must be present + ;--- ok.ll ; RUN: llc -mtriple=aarch64-linux ok.ll -o - | \ @@ -7,11 +9,6 @@ ; RUN: llc -mtriple=aarch64-linux ok.ll -filetype=obj -o - | \ ; RUN: llvm-readelf --notes - | FileCheck %s --check-prefix=OBJ -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} -!1 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 1365} - ; ASM: .section .note.gnu.property,"a",@note ; ASM-NEXT: .p2align 3, 0x0 ; ASM-NEXT: .word 4 @@ -29,7 +26,28 @@ ; OBJ-NEXT: GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 (property note) ; OBJ-NEXT: AArch64 PAuth ABI core info: platform 0x10000002 (llvm_linux), version 0x555 (PointerAuthIntrinsics, !PointerAuthCalls, PointerAuthReturns, !PointerAuthAuthTraps, PointerAuthVTPtrAddressDiscrimination, !PointerAuthVTPtrTypeDiscrimination, PointerAuthInitFini, !PointerAuthInitFiniAddressDiscrimination, PointerAuthELFGOT, !PointerAuthIndirectGotos, PointerAuthTypeInfoVTPtrDiscrimination, !PointerAuthFPtrTypeDiscrimination) -; ERR: either both or no 'aarch64-elf-pauthabi-platform' and 'aarch64-elf-pauthabi-version' module flags must be present +!llvm.module.flags = !{!0, !1} + +!0 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} +!1 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 1365} + +;--- omit.ll + +; For LLVM_LINUX experimental platform, version value of 0 means no PAuth support. +; Do not emit corresponding PAuthABI GNU property note and AArch64 build attributes +; for this case to keep Linux binaries not using PAuth unaffected. + +; RUN: llc -mtriple=aarch64-linux omit.ll -o - | \ +; RUN: FileCheck %s --check-prefix=ASM-OMIT +; RUN: llc -mtriple=aarch64-linux omit.ll -filetype=obj -o - | \ +; RUN: llvm-readelf --notes - | count 0 + +; ASM-OMIT-NOT: .note.gnu.property + +!llvm.module.flags = !{!0, !1} + +!0 = !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} +!1 = !{i32 1, !"aarch64-elf-pauthabi-version", i32 0} ;--- err1.ll diff --git a/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll b/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll index bc74781693879..37b9088d73338 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll @@ -8,11 +8,6 @@ ; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=obj auth.ll -o - | \ ; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ -; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth1.ll -o - | \ -; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH -; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth2.ll -o - | \ -; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH - ; ASM: .type foo,@function ; ASM-LABEL: foo: ; ASM: adrp x17, :got_auth:bar @@ -38,6 +33,30 @@ ; OBJ-NEXT: Num: Value Size Type Bind Vis Ndx Name ; OBJ: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bar + +; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm noauth1.ll -o - | \ +; RUN: FileCheck %s --check-prefix=ASM-NOAUTH +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth1.ll -o - | \ +; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH + +; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm noauth2.ll -o - | \ +; RUN: FileCheck %s --check-prefix=ASM-NOAUTH +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth2.ll -o - | \ +; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH + +; ASM-NOAUTH: .type foo,@function +; ASM-NOAUTH-LABEL: foo: +; ASM-NOAUTH: adrp x16, :got:bar +; ASM-NOAUTH-NEXT: ldr x16, [x16, :got_lo12:bar] +; ASM-NOAUTH-NEXT: paciza x16 +; ASM-NOAUTH-NEXT: adrp x8, .Lfptr +; ASM-NOAUTH-NEXT: str x16, [x8, :lo12:.Lfptr] +; ASM-NOAUTH-NEXT: ret +; ASM-NOAUTH: .type .Lfptr,@object +; ASM-NOAUTH-NEXT: .local .Lfptr +; ASM-NOAUTH-NEXT: .comm .Lfptr,8,8 +; ASM-NOAUTH-NOT: .type bar,@function + ; OBJ-NOAUTH: Symbol table '.symtab' contains [[#]] entries: ; OBJ-NOAUTH-NEXT: Num: Value Size Type Bind Vis Ndx Name ; OBJ-NOAUTH: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar >From dd686bc09f68c4cd71a73f4fda15e3096cf2e120 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev <[email protected]> Date: Mon, 13 Jul 2026 17:04:13 +0300 Subject: [PATCH 8/8] Test enhancements --- clang/test/CodeGen/AArch64/elf-pauthabi.c | 11 ++++++++++ clang/test/CodeGen/ptrauth-module-flags.c | 21 +++++++++++++------ .../ptrauth-elf-got-function-symbols.ll | 8 +++---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/clang/test/CodeGen/AArch64/elf-pauthabi.c b/clang/test/CodeGen/AArch64/elf-pauthabi.c index 155c0dc0120d5..d76caf2a1bddb 100644 --- a/clang/test/CodeGen/AArch64/elf-pauthabi.c +++ b/clang/test/CodeGen/AArch64/elf-pauthabi.c @@ -13,6 +13,15 @@ // RUN: -fptrauth-function-pointer-type-discrimination %s | \ // RUN: FileCheck %s --check-prefix=ALL +// RUN: %clang_cc1 -triple aarch64-freebsd -emit-llvm -o - \ +// RUN: %s | FileCheck %s --check-prefix=ABSENT + +// RUN: %clang_cc1 -triple aarch64-darwin -emit-llvm -o - \ +// RUN: %s | FileCheck %s --check-prefix=ABSENT + +// RUN: %clang_cc1 -triple aarch64-windows -emit-llvm -o - \ +// RUN: %s | FileCheck %s --check-prefix=ABSENT + // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ // RUN: %s | FileCheck %s --check-prefix=NONE @@ -61,6 +70,8 @@ // ALL: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} // ALL: !{i32 1, !"aarch64-elf-pauthabi-version", i32 4095} +// ABSENT-NOT: aarch64-elf-pauthabi + // NONE: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} // NONE: !{i32 1, !"aarch64-elf-pauthabi-version", i32 0} diff --git a/clang/test/CodeGen/ptrauth-module-flags.c b/clang/test/CodeGen/ptrauth-module-flags.c index ffe62ec25f655..4134a797204db 100644 --- a/clang/test/CodeGen/ptrauth-module-flags.c +++ b/clang/test/CodeGen/ptrauth-module-flags.c @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=OFF +// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=OFF-LINUX +// RUN: %clang_cc1 -triple aarch64-freebsd -emit-llvm %s -o - | FileCheck %s --check-prefix=OFF-ELF +// RUN: %clang_cc1 -triple aarch64-darwin -emit-llvm %s -o - | FileCheck %s --check-prefix=ABSENT +// RUN: %clang_cc1 -triple aarch64-windows -emit-llvm %s -o - | FileCheck %s --check-prefix=ABSENT // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-elf-got -emit-llvm %s -o - | FileCheck %s --check-prefix=ELFGOT // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefix=PERSONALITY @@ -14,8 +17,14 @@ // PERSONALITY: !0 = !{i32 1, !"ptrauth-elf-got", i32 0} // PERSONALITY: !1 = !{i32 1, !"ptrauth-sign-personality", i32 1} -// OFF: !llvm.module.flags = !{ -// OFF-SAME: !0 -// OFF-SAME: !1 -// OFF: !0 = !{i32 1, !"ptrauth-elf-got", i32 0} -// OFF: !1 = !{i32 1, !"ptrauth-sign-personality", i32 0} +// OFF-LINUX: !llvm.module.flags = !{ +// OFF-LINUX-SAME: !0 +// OFF-LINUX-SAME: !1 +// OFF-LINUX: !0 = !{i32 1, !"ptrauth-elf-got", i32 0} +// OFF-LINUX: !1 = !{i32 1, !"ptrauth-sign-personality", i32 0} + +// OFF-ELF: !llvm.module.flags = !{ +// OFF-ELF-SAME: !0 +// OFF-ELF: !0 = !{i32 1, !"ptrauth-elf-got", i32 0} + +// ABSENT-NOT: "ptrauth- diff --git a/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll b/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll index 37b9088d73338..d7ceccd459473 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-elf-got-function-symbols.ll @@ -3,9 +3,9 @@ ; RUN: cat common.ll elf-got-flag-0.ll > noauth1.ll ; RUN: cat common.ll > noauth2.ll -; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm auth.ll -o - | \ +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=asm auth.ll -o - | \ ; RUN: FileCheck %s --check-prefix=ASM -; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=obj auth.ll -o - | \ +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj auth.ll -o - | \ ; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ ; ASM: .type foo,@function @@ -34,12 +34,12 @@ ; OBJ: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bar -; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm noauth1.ll -o - | \ +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=asm noauth1.ll -o - | \ ; RUN: FileCheck %s --check-prefix=ASM-NOAUTH ; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth1.ll -o - | \ ; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH -; RUN: llc -mtriple aarch64-linux-pauthtest -mattr +pauth -filetype=asm noauth2.ll -o - | \ +; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=asm noauth2.ll -o - | \ ; RUN: FileCheck %s --check-prefix=ASM-NOAUTH ; RUN: llc -mtriple aarch64-linux-gnu -mattr +pauth -filetype=obj noauth2.ll -o - | \ ; RUN: llvm-readelf -s - | FileCheck %s --check-prefix=OBJ-NOAUTH _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
