Skip to content
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

[test][PAC][clang] Add missing tests against linux triples #99482

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

kovdan01
Copy link
Contributor

@kovdan01 kovdan01 commented Jul 18, 2024

Enhance tests introduced in #94056, #96992, #98276 and #98847 by adding RUN and CHECK lines against linux triples.

@kovdan01 kovdan01 self-assigned this Jul 18, 2024
@kovdan01 kovdan01 marked this pull request as ready for review July 18, 2024 13:05
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 18, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 18, 2024

@llvm/pr-subscribers-clang

Author: Daniil Kovalev (kovdan01)

Changes

Enhance tests introduced in #94056, #96992 and #98276 by adding RUN and CHECK lines against linux triples.


Patch is 43.12 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/99482.diff

12 Files Affected:

  • (modified) clang/test/CodeGen/ptrauth-function-type-discriminator.c (+22-11)
  • (modified) clang/test/CodeGen/ptrauth-ubsan-vptr.cpp (+3)
  • (modified) clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp (+39-23)
  • (modified) clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp (+10-4)
  • (modified) clang/test/CodeGenCXX/ptrauth-static-destructors.cpp (+11-4)
  • (modified) clang/test/CodeGenCXX/ptrauth-throw.cpp (+9-6)
  • (modified) clang/test/CodeGenCXX/ptrauth-thunks.cpp (+2-1)
  • (modified) clang/test/CodeGenCXX/ptrauth-virtual-function.cpp (+39-30)
  • (modified) clang/test/CodeGenCXX/ptrauth-vtable-virtual-inheritance-thunk.cpp (+14-6)
  • (modified) clang/test/CodeGenCXX/ubsan-vtable-checks.cpp (+3-1)
  • (modified) clang/test/SemaCXX/ptrauth-incomplete-virtual-member-function-return-arg-type.cpp (+2-1)
  • (modified) clang/test/SemaCXX/vtable_pointer_authentication_attribute.cpp (+2-1)
diff --git a/clang/test/CodeGen/ptrauth-function-type-discriminator.c b/clang/test/CodeGen/ptrauth-function-type-discriminator.c
index 5dea48fe5915b..58717015adb6c 100644
--- a/clang/test/CodeGen/ptrauth-function-type-discriminator.c
+++ b/clang/test/CodeGen/ptrauth-function-type-discriminator.c
@@ -1,7 +1,18 @@
-// RUN: %clang_cc1 %s       -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKC
-// RUN: %clang_cc1 -xc++ %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefix=CHECK
-// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-pch %s -o %t.ast
-// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -x ast -o - %t.ast | FileCheck -check-prefix=CHECK --check-prefix=CHECKC %s
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -disable-llvm-passes -emit-llvm %s       -o- | FileCheck --check-prefixes=CHECK,CHECKC %s
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -disable-llvm-passes -emit-llvm -xc++ %s -o- | FileCheck --check-prefix=CHECK %s
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios    -fptrauth-calls -fptrauth-intrinsics -emit-pch %s -o %t.ast
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios    -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -emit-llvm -x ast -o - %t.ast | FileCheck --check-prefixes=CHECK,CHECKC %s
+
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple aarch64-linux-gnu  -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -disable-llvm-passes -emit-llvm %s       -o- | FileCheck --check-prefixes=CHECK,CHECKC %s
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple aarch64-linux-gnu  -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -disable-llvm-passes -emit-llvm -xc++ %s -o- | FileCheck --check-prefix=CHECK %s
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple aarch64-linux-gnu  -fptrauth-calls -fptrauth-intrinsics -emit-pch %s -o %t.ast
+// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple aarch64-linux-gnu  -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -emit-llvm -x ast -o - %t.ast | FileCheck --check-prefixes=CHECK,CHECKC %s
 
 #ifdef __cplusplus
 extern "C" {
@@ -47,14 +58,14 @@ void (*fptr3)(void) = __builtin_ptrauth_sign_constant(&external_function, 2, 26)
 // CHECK: @fptr4 = global ptr ptrauth (ptr @external_function, i32 2, i64 26, ptr @fptr4)
 void (*fptr4)(void) = __builtin_ptrauth_sign_constant(&external_function, 2, __builtin_ptrauth_blend_discriminator(&fptr4, 26));
 
-// CHECK-LABEL: define void @test_call()
+// CHECK-LABEL: define{{.*}} void @test_call()
 void test_call() {
   // CHECK:      [[T0:%.*]] = load ptr, ptr @fnptr,
   // CHECK-NEXT: call void [[T0]]() [ "ptrauth"(i32 0, i64 18983) ]
   fnptr();
 }
 
-// CHECK-LABEL: define ptr @test_function_pointer()
+// CHECK-LABEL: define{{.*}} ptr @test_function_pointer()
 // CHECK:  ret ptr ptrauth (ptr @external_function, i32 0, i64 18983)
 void (*test_function_pointer())(void) {
   return external_function;
@@ -62,14 +73,14 @@ void (*test_function_pointer())(void) {
 
 struct InitiallyIncomplete;
 extern struct InitiallyIncomplete returns_initially_incomplete(void);
-// CHECK-LABEL: define void @use_while_incomplete()
+// CHECK-LABEL: define{{.*}} void @use_while_incomplete()
 void use_while_incomplete() {
   // CHECK:      [[VAR:%.*]] = alloca ptr,
   // CHECK-NEXT: store ptr ptrauth (ptr @returns_initially_incomplete, i32 0, i64 25106), ptr [[VAR]]
   struct InitiallyIncomplete (*fnptr)(void) = &returns_initially_incomplete;
 }
 struct InitiallyIncomplete { int x; };
-// CHECK-LABEL: define void @use_while_complete()
+// CHECK-LABEL: define{{.*}} void @use_while_complete()
 void use_while_complete() {
   // CHECK:      [[VAR:%.*]] = alloca ptr,
   // CHECK-NEXT: store ptr ptrauth (ptr @returns_initially_incomplete, i32 0, i64 25106), ptr [[VAR]]
@@ -83,7 +94,7 @@ void knr(param)
   int param;
 {}
 
-// CHECKC-LABEL: define void @test_knr
+// CHECKC-LABEL: define{{.*}} void @test_knr
 void test_knr() {
   void (*p)() = knr;
   p(0);
@@ -94,7 +105,7 @@ void test_knr() {
   // CHECKC: call void [[LOAD]](i32 noundef 0) [ "ptrauth"(i32 0, i64 18983) ]
 }
 
-// CHECKC-LABEL: define void @test_redeclaration
+// CHECKC-LABEL: define{{.*}} void @test_redeclaration
 void test_redeclaration() {
   void redecl();
   void (*ptr)() = redecl;
@@ -113,7 +124,7 @@ void knr2(param)
      int param;
 {}
 
-// CHECKC-LABEL: define void @test_redecl_knr
+// CHECKC-LABEL: define{{.*}} void @test_redecl_knr
 void test_redecl_knr() {
   void (*p)() = knr2;
   p();
diff --git a/clang/test/CodeGen/ptrauth-ubsan-vptr.cpp b/clang/test/CodeGen/ptrauth-ubsan-vptr.cpp
index 6c36004641477..8045e7bdc7460 100644
--- a/clang/test/CodeGen/ptrauth-ubsan-vptr.cpp
+++ b/clang/test/CodeGen/ptrauth-ubsan-vptr.cpp
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 -triple arm64e-apple-ios15 -fsanitize=vptr -O0 -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple arm64e-apple-ios15 -fsanitize=vptr -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
 
+// RUN: %clang_cc1 -triple aarch64-linux-gnu  -fsanitize=vptr -O0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-linux-gnu  -fsanitize=vptr -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
+
 struct S {
   S() {}
   ~S() {}
diff --git a/clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp b/clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp
index e6497b3f152aa..1b103719fbe46 100644
--- a/clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp
+++ b/clang/test/CodeGenCXX/ptrauth-explicit-vtable-pointer-control.cpp
@@ -1,15 +1,31 @@
 // RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics \
 // RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,NODISC %s
 
-// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics \
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios   -fptrauth-calls -fptrauth-intrinsics \
 // RUN:   -fptrauth-vtable-pointer-type-discrimination \
 // RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,TYPE %s
 
-// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics \
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios   -fptrauth-calls -fptrauth-intrinsics \
 // RUN:   -fptrauth-vtable-pointer-address-discrimination \
 // RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,ADDR %s
 
-// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics \
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple arm64-apple-ios   -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -fptrauth-vtable-pointer-type-discrimination \
+// RUN:   -fptrauth-vtable-pointer-address-discrimination \
+// RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,BOTH %s
+
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,NODISC %s
+
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -fptrauth-vtable-pointer-type-discrimination \
+// RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,TYPE %s
+
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics \
+// RUN:   -fptrauth-vtable-pointer-address-discrimination \
+// RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,ADDR %s
+
+// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics \
 // RUN:   -fptrauth-vtable-pointer-type-discrimination \
 // RUN:   -fptrauth-vtable-pointer-address-discrimination \
 // RUN:   -emit-llvm -o - | FileCheck --check-prefixes=CHECK,BOTH %s
@@ -111,7 +127,7 @@ int TVDisc_ExplicitNoExtraDiscrimination = ptrauth_string_discriminator("_ZTVN5t
 int TVDisc_ExplicitTypeDiscrimination = ptrauth_string_discriminator("_ZTVN5test126ExplicitTypeDiscriminationE");
 
 
-// CHECK-LABEL: define void @test_default(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_default(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -133,7 +149,7 @@ void test_default(NoExplicitAuth *a) {
   a->f();
 }
 
-// CHECK-LABEL: define void @test_disabled(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_disabled(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 // CHECK-NOT:     call i64 @llvm.ptrauth.auth
@@ -141,7 +157,7 @@ void test_disabled(ExplicitlyDisableAuth *a) {
   a->f();
 }
 
-// CHECK-LABEL: define void @test_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -166,7 +182,7 @@ void test_addr_disc(ExplicitAddressDiscrimination *a) {
   a->f();
 }
 
-// CHECK-LABEL: define void @test_no_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_no_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -185,7 +201,7 @@ void test_no_addr_disc(ExplicitNoAddressDiscrimination *a) {
   a->f();
 }
 
-// CHECK-LABEL: define void @test_no_extra_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_no_extra_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -206,7 +222,7 @@ void test_no_extra_disc(ExplicitNoExtraDiscrimination *a) {
   a->f();
 }
 
-// CHECK-LABEL: define void @test_type_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_type_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -229,7 +245,7 @@ void test_type_disc(ExplicitTypeDiscrimination *a) {
   a->f();
 }
 
-// CHECK-LABEL: define void @test_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = load ptr, ptr {{%.*}}, align 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -257,7 +273,7 @@ void test_custom_disc(ExplicitCustomDiscrimination *a) {
 // Codegen should be the same as the simple cases above once we have a vtable.
 //
 
-// CHECK-LABEL: define void @test_subclass_default(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_default(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -279,7 +295,7 @@ void test_subclass_default(NoExplicitAuth *a) {
   make_subclass(a)->f();
 }
 
-// CHECK-LABEL: define void @test_subclass_disabled(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_disabled(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 // CHECK-NOT:     call i64 @llvm.ptrauth.auth
@@ -287,7 +303,7 @@ void test_subclass_disabled(ExplicitlyDisableAuth *a) {
   make_subclass(a)->f();
 }
 
-// CHECK-LABEL: define void @test_subclass_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -312,7 +328,7 @@ void test_subclass_addr_disc(ExplicitAddressDiscrimination *a) {
   make_subclass(a)->f();
 }
 
-// CHECK-LABEL: define void @test_subclass_no_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_no_addr_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -331,7 +347,7 @@ void test_subclass_no_addr_disc(ExplicitNoAddressDiscrimination *a) {
   make_subclass(a)->f();
 }
 
-// CHECK-LABEL: define void @test_subclass_no_extra_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_no_extra_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -352,7 +368,7 @@ void test_subclass_no_extra_disc(ExplicitNoExtraDiscrimination *a) {
   make_subclass(a)->f();
 }
 
-// CHECK-LABEL: define void @test_subclass_type_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_type_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -375,7 +391,7 @@ void test_subclass_type_disc(ExplicitTypeDiscrimination *a) {
   make_subclass(a)->f();
 }
 
-// CHECK-LABEL: define void @test_subclass_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_subclass_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTADDR:%.*]] = call noundef ptr @_ZN5test113make_subclass
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
 //
@@ -404,7 +420,7 @@ void test_subclass_custom_disc(ExplicitCustomDiscrimination *a) {
 // Codegen should be the same as the simple cases above once we have a vtable.
 //
 
-// CHECK-LABEL: define void @test_multiple_default(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_multiple_default(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[CALL:%.*]] = call noundef ptr @_ZN5test121make_multiple_primary
 // CHECK:         [[VTADDR:%.*]] = getelementptr inbounds i8, ptr [[CALL]], i64 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
@@ -427,7 +443,7 @@ void test_multiple_default(NoExplicitAuth *a) {
   make_multiple_primary(a)->f();
 }
 
-// CHECK-LABEL: define void @test_multiple_disabled(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_multiple_disabled(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[CALL:%.*]] = call noundef ptr @_ZN5test121make_multiple_primary
 // CHECK:         [[VTADDR:%.*]] = getelementptr inbounds i8, ptr [[CALL]], i64 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
@@ -436,7 +452,7 @@ void test_multiple_disabled(ExplicitlyDisableAuth *a) {
   make_multiple_primary(a)->f();
 }
 
-// CHECK-LABEL: define void @test_multiple_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_multiple_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[CALL:%.*]] = call noundef ptr @_ZN5test121make_multiple_primary
 // CHECK:         [[VTADDR:%.*]] = getelementptr inbounds i8, ptr [[CALL]], i64 8
 // CHECK:         [[VTABLE:%.*]] = load ptr, ptr [[VTADDR]], align 8
@@ -466,7 +482,7 @@ void test_multiple_custom_disc(ExplicitCustomDiscrimination *a) {
 // but twice for vtt/vtable.  The names in the vtt version have "VTT" prefixes.
 //
 
-// CHECK-LABEL: define void @test_virtual_default(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_virtual_default(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTTADDR:%.*]] = call noundef ptr @_ZN5test120make_virtual_primary
 // CHECK:         [[VTTABLE:%.*]] = load ptr, ptr [[VTTADDR]], align 8
 //
@@ -509,13 +525,13 @@ void test_virtual_default(NoExplicitAuth *a) {
   make_virtual_primary(a)->f();
 }
 
-// CHECK-LABEL: define void @test_virtual_disabled(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_virtual_disabled(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK-NOT:     call i64 @llvm.ptrauth.auth
 void test_virtual_disabled(ExplicitlyDisableAuth *a) {
   make_virtual_primary(a)->f();
 }
 
-// CHECK-LABEL: define void @test_virtual_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
+// CHECK-LABEL: define{{.*}} void @test_virtual_custom_disc(ptr noundef {{%.*}}) {{#.*}} {
 // CHECK:         [[VTTADDR:%.*]] = call noundef ptr @_ZN5test120make_virtual_primary
 // CHECK:         [[VTTABLE:%.*]] = load ptr, ptr [[VTTADDR]], align 8
 //
diff --git a/clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp b/clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp
index b4a8784a33d8c..2b633addd677e 100644
--- a/clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp
+++ b/clang/test/CodeGenCXX/ptrauth-rtti-layout.cpp
@@ -1,10 +1,16 @@
-// RUN: %clang_cc1 %s -I%S -triple=arm64-apple-ios -fptrauth-calls -std=c++11 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -I%S -triple=arm64-apple-ios   -fptrauth-calls -std=c++11 -emit-llvm -o - | FileCheck --check-prefix=DARWIN %s
+// RUN: %clang_cc1 %s -I%S -triple=aarch64-linux-gnu -fptrauth-calls -std=c++11 -emit-llvm -o - | FileCheck --check-prefix=ELF %s
+
 #include <typeinfo>
 
 struct A { int a; };
 
-// CHECK: @_ZTVN10__cxxabiv117__class_type_infoE = external global [0 x ptr]
-// CHECK: @_ZTS1A = linkonce_odr hidden constant [3 x i8] c"1A\00"
-// CHECK: @_ZTI1A = linkonce_odr hidden constant { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), i32 2), ptr inttoptr (i64 add (i64 ptrtoint (ptr @_ZTS1A to i64), i64 -9223372036854775808) to ptr) }
+// DARWIN: @_ZTVN10__cxxabiv117__class_type_infoE = external global [0 x ptr]
+// DARWIN: @_ZTS1A = linkonce_odr hidden constant [3 x i8] c"1A\00"
+// DARWIN: @_ZTI1A = linkonce_odr hidden constant { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), i32 2), ptr inttoptr (i64 add (i64 ptrtoint (ptr @_ZTS1A to i64), i64 -9223372036854775808) to ptr) }
+
+// ELF: @_ZTVN10__cxxabiv117__class_type_infoE = external global [0 x ptr]
+// ELF: @_ZTS1A = linkonce_odr constant [3 x i8] c"1A\00"
+// ELF: @_ZTI1A = linkonce_odr constant { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), i32 2), ptr @_ZTS1A }
 
 auto ATI = typeid(A);
diff --git a/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp b/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp
index cad43dc0746df..1240f26d329da 100644
--- a/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp
+++ b/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp
@@ -2,8 +2,13 @@
 // RUN:  | FileCheck %s --check-prefix=CXAATEXIT
 
 // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm -std=c++11 %s -o - \
-// RUN:    -fno-use-cxa-atexit \
-// RUN:  | FileCheck %s --check-prefix=ATEXIT
+// RUN:    -fno-use-cxa-atexit | FileCheck %s --check-prefixes=ATEXIT,DARWIN
+
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm -std=c++11 %s -o - \
+// RUN:  | FileCheck %s --check-prefix=CXAATEXIT
+
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm -std=c++11 %s -o - \
+// RUN:    -fno-use-cxa-atexit | FileCheck %s --check-prefixes=ATEXIT,ELF
 
 class Foo {
  public:
@@ -20,5 +25,7 @@ Foo global;
 // ATEXIT: define internal void @__cxx_global_var_init()
 // ATEXIT:   %{{.*}} = call i32 @atexit(ptr ptrauth (ptr @__dtor_global, ...
[truncated]

@kovdan01
Copy link
Contributor Author

Also tagging @ojhunt (GitHub doesn't let to add as a reviewer for some unknown reason)

Copy link
Collaborator

@asl asl left a comment

Choose a reason for hiding this comment

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

Thanks!

@kovdan01 kovdan01 merged commit a1d77ca into llvm:main Jul 19, 2024
4 of 7 checks passed
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this pull request Jul 23, 2024
Enhance tests introduced in llvm#94056, llvm#96992, llvm#98276 and llvm#98847 by adding
RUN and CHECK lines against linux triples.
@kovdan01 kovdan01 deleted the pauth-elf-tests branch July 23, 2024 20:49
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
Enhance tests introduced in #94056, #96992, #98276 and #98847 by adding
RUN and CHECK lines against linux triples.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251378
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.

3 participants