Skip to content

Commit 978f39e

Browse files
committed
Merge commit 'ccd8d0497a92' from llvm.org/release/19.x into stable/20240723
rdar://133593985
2 parents 4d52488 + ccd8d04 commit 978f39e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
880880

881881
// Add pointer authentication attributes.
882882
const CodeGenOptions &CodeGenOpts = CGM.getCodeGenOpts();
883-
if (CodeGenOpts.PointerAuth.FunctionPointers)
884-
Fn->addFnAttr("ptrauth-calls");
885883
if (CodeGenOpts.PointerAuth.ReturnAddresses)
886884
Fn->addFnAttr("ptrauth-returns");
885+
if (CodeGenOpts.PointerAuth.FunctionPointers)
886+
Fn->addFnAttr("ptrauth-calls");
887887
if (CodeGenOpts.PointerAuth.IndirectGotos)
888888
Fn->addFnAttr("ptrauth-indirect-gotos");
889889
if (CodeGenOpts.PointerAuth.AuthTraps)

clang/lib/Headers/ptrauth.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ typedef enum {
2828
/* A process-specific key which can be used to sign data pointers. */
2929
ptrauth_key_process_dependent_data = ptrauth_key_asdb,
3030

31-
/* The key used to sign C function pointers.
32-
The extra data is always 0. */
33-
ptrauth_key_function_pointer = ptrauth_key_process_independent_code,
34-
3531
/* The key used to sign return addresses on the stack.
3632
The extra data is based on the storage address of the return address.
37-
On ARM64, that is always the storage address of the return address plus 8
33+
On AArch64, that is always the storage address of the return address + 8
3834
(or, in other words, the value of the stack pointer on function entry) */
3935
ptrauth_key_return_address = ptrauth_key_process_dependent_code,
4036

37+
/* The key used to sign C function pointers.
38+
The extra data is always 0. */
39+
ptrauth_key_function_pointer = ptrauth_key_process_independent_code,
40+
4141
/* The key used to sign frame pointers on the stack.
4242
The extra data is based on the storage address of the frame pointer.
4343
On ARM64, that is always the storage address of the frame pointer plus 16

clang/test/CodeGen/ptrauth-function-attributes.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
12
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
23
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
34

4-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
5+
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
56
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
67

8+
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
9+
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
10+
711
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS
8-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS
912
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS
1013

11-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
12-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
13-
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
14-
1514
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
1615
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
1716
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
@@ -23,6 +22,7 @@ void test() {
2322
// CALLS: attributes #0 = {{{.*}} "ptrauth-calls" {{.*}}}
2423

2524
// RETS: attributes #0 = {{{.*}} "ptrauth-returns" {{.*}}}
25+
2626
// GOTOS: attributes #0 = {{{.*}} "ptrauth-indirect-gotos" {{.*}}}
2727
// TRAPS: attributes #0 = {{{.*}} "ptrauth-auth-traps" {{.*}}}
2828

0 commit comments

Comments
 (0)