Skip to content

[clang][test] Add function type discrimination tests to static destructor tests #99604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ojhunt
Copy link
Contributor

@ojhunt ojhunt commented Jul 19, 2024

I accidentally did not include tests for the setting up runtime calls when compiling with -fptrauth-function-pointer-type-discrimination

…c-destructors

I accidentally did not include tests for the setting up runtime calls
when compiling with -fptrauth-function-pointer-type-discrimination
@ojhunt ojhunt marked this pull request as ready for review July 19, 2024 04:14
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 19, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 19, 2024

@llvm/pr-subscribers-clang

Author: Oliver Hunt (ojhunt)

Changes

I accidentally did not include tests for the setting up runtime calls when compiling with -fptrauth-function-pointer-type-discrimination


Full diff: https://github.com/llvm/llvm-project/pull/99604.diff

1 Files Affected:

  • (modified) clang/test/CodeGenCXX/ptrauth-static-destructors.cpp (+12)
diff --git a/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp b/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp
index cad43dc0746df..92daf6bbea8b7 100644
--- a/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp
+++ b/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp
@@ -5,6 +5,13 @@
 // RUN:    -fno-use-cxa-atexit \
 // RUN:  | FileCheck %s --check-prefix=ATEXIT
 
+// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm -std=c++11 %s \
+// RUN:  -fptrauth-function-pointer-type-discrimination  -o - | FileCheck %s --check-prefix=CXAATEXIT_DISC
+
+// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm -std=c++11 %s -o - \
+// RUN:   -fptrauth-function-pointer-type-discrimination  -fno-use-cxa-atexit \
+// RUN:  | FileCheck %s --check-prefix=ATEXIT_DISC
+
 class Foo {
  public:
   ~Foo() {
@@ -16,9 +23,14 @@ Foo global;
 // CXAATEXIT: define internal void @__cxx_global_var_init()
 // CXAATEXIT:   call i32 @__cxa_atexit(ptr ptrauth (ptr @_ZN3FooD1Ev, i32 0), ptr @global, ptr @__dso_handle)
 
+// CXAATEXIT_DISC: define internal void @__cxx_global_var_init()
+// CXAATEXIT_DISC:   call i32 @__cxa_atexit(ptr ptrauth (ptr @_ZN3FooD1Ev, i32 0, i64 10942), ptr @global, ptr @__dso_handle)
 
 // ATEXIT: define internal void @__cxx_global_var_init()
 // ATEXIT:   %{{.*}} = call i32 @atexit(ptr ptrauth (ptr @__dtor_global, i32 0))
 
 // ATEXIT: define internal void @__dtor_global() {{.*}} section "__TEXT,__StaticInit,regular,pure_instructions" {
 // ATEXIT:   %{{.*}} = call ptr @_ZN3FooD1Ev(ptr @global)
+
+// ATEXIT_DISC: define internal void @__cxx_global_var_init()
+// ATEXIT_DISC:   %{{.*}} = call i32 @atexit(ptr ptrauth (ptr @__dtor_global, i32 0, i64 10942))

@asl asl requested a review from kovdan01 July 22, 2024 07:19
@asl
Copy link
Collaborator

asl commented Jul 22, 2024

@ojhunt Rebase?

@asl asl self-requested a review July 22, 2024 07:19
ojhunt added 4 commits July 22, 2024 15:55
…ptrauth-static-destructors-function-type-discrimination
…ptrauth-static-destructors-function-type-discrimination
…ptrauth-static-destructors-function-type-discrimination
Copy link
Contributor

@kovdan01 kovdan01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@asl asl added this to the LLVM 19.X Release milestone Jul 23, 2024
@asl asl merged commit 8be1325 into llvm:main Jul 23, 2024
5 of 7 checks passed
@asl asl deleted the user/oliver/ptrauth-static-destructors-function-type-discrimination branch July 23, 2024 21:18
llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 23, 2024
…ctor tests (llvm#99604)

I accidentally did not include tests for the setting up runtime calls when compiling with -fptrauth-function-pointer-type-discrimination

(cherry picked from commit 8be1325)
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 24, 2024
…ctor tests (llvm#99604)

I accidentally did not include tests for the setting up runtime calls when compiling with -fptrauth-function-pointer-type-discrimination

(cherry picked from commit 8be1325)
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…ctor tests (#99604)

Summary: I accidentally did not include tests for the setting up runtime calls when compiling with -fptrauth-function-pointer-type-discrimination

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants