Skip to content

Commit 7432b76

Browse files
author
git apple-llvm automerger
committed
Merge commit '955fe3f1ef19' from llvm.org/release/19.x into stable/20240723
2 parents 79d2186 + 8a5a539 commit 7432b76

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

clang/include/clang/Basic/PointerAuthOptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ struct PointerAuthOptions {
215215
/// Should return addresses be authenticated?
216216
bool ReturnAddresses = false;
217217

218-
/// Do indirect goto label addresses need to be authenticated?
219-
bool IndirectGotos = false;
220-
221218
/// Do authentication failures cause a trap?
222219
bool AuthTraps = false;
223220

221+
/// Do indirect goto label addresses need to be authenticated?
222+
bool IndirectGotos = false;
223+
224224
/// The ABI for C function pointers.
225225
PointerAuthSchema FunctionPointers;
226226

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,10 +884,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
884884
Fn->addFnAttr("ptrauth-returns");
885885
if (CodeGenOpts.PointerAuth.FunctionPointers)
886886
Fn->addFnAttr("ptrauth-calls");
887-
if (CodeGenOpts.PointerAuth.IndirectGotos)
888-
Fn->addFnAttr("ptrauth-indirect-gotos");
889887
if (CodeGenOpts.PointerAuth.AuthTraps)
890888
Fn->addFnAttr("ptrauth-auth-traps");
889+
if (CodeGenOpts.PointerAuth.IndirectGotos)
890+
Fn->addFnAttr("ptrauth-indirect-gotos");
891891

892892
// Apply xray attributes to the function (as a string, for now)
893893
bool AlwaysXRayAttr = false;

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,17 +1690,17 @@ void CompilerInvocation::setDefaultPointerAuthOptions(
16901690
Opts.ObjCMethodListFunctionPointers =
16911691
PointerAuthSchema(Key::ASIA, true, Discrimination::None);
16921692
}
1693-
Opts.IndirectGotos = LangOpts.PointerAuthIndirectGotos;
16941693
Opts.ReturnAddresses = LangOpts.PointerAuthReturns;
16951694
Opts.AuthTraps = LangOpts.PointerAuthAuthTraps;
1695+
Opts.IndirectGotos = LangOpts.PointerAuthIndirectGotos;
16961696
}
16971697

16981698
static void parsePointerAuthOptions(PointerAuthOptions &Opts,
16991699
const LangOptions &LangOpts,
17001700
const llvm::Triple &Triple,
17011701
DiagnosticsEngine &Diags) {
1702-
if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthIndirectGotos &&
1703-
!LangOpts.PointerAuthReturns && !LangOpts.PointerAuthAuthTraps)
1702+
if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthReturns &&
1703+
!LangOpts.PointerAuthAuthTraps && !LangOpts.PointerAuthIndirectGotos)
17041704
return;
17051705

17061706
CompilerInvocation::setDefaultPointerAuthOptions(Opts, LangOpts, Triple);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
99
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
1010

11+
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
12+
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
13+
1114
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS
1215
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS
1316

14-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
15-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
16-
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
17-
1817
// ALL: define {{(dso_local )?}}void @test() #0
1918
void test() {
2019
}
@@ -23,7 +22,8 @@ void test() {
2322

2423
// RETS: attributes #0 = {{{.*}} "ptrauth-returns" {{.*}}}
2524

26-
// GOTOS: attributes #0 = {{{.*}} "ptrauth-indirect-gotos" {{.*}}}
2725
// TRAPS: attributes #0 = {{{.*}} "ptrauth-auth-traps" {{.*}}}
2826

27+
// GOTOS: attributes #0 = {{{.*}} "ptrauth-indirect-gotos" {{.*}}}
28+
2929
// OFF-NOT: attributes {{.*}} "ptrauth-

0 commit comments

Comments
 (0)