From 4039d17355b7dc54d847d05d8685912cf081a113 Mon Sep 17 00:00:00 2001 From: Qiu Chaofan Date: Thu, 30 Dec 2021 10:13:41 +0800 Subject: [PATCH] [NFC] Specify targets for clang stack-protector-guard.c The run line of stack-protector-guard.c doesn't specify the triple, which means it depends on the platform running the test. This makes some failure hidden. Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D116003 --- clang/test/CodeGen/stack-protector-guard.c | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/clang/test/CodeGen/stack-protector-guard.c b/clang/test/CodeGen/stack-protector-guard.c index a5483ba0f194..5839ab06033a 100644 --- a/clang/test/CodeGen/stack-protector-guard.c +++ b/clang/test/CodeGen/stack-protector-guard.c @@ -1,16 +1,25 @@ -// RUN: %clang_cc1 -mstack-protector-guard=sysreg \ -// RUN: -mstack-protector-guard-reg=sp_el0 \ -// RUN: -mstack-protector-guard-offset=1024 \ -// RUN: -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-NONE %s +// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple x86_64-linux-gnu \ +// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple powerpc64le-linux-gnu \ +// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple arm-linux-gnueabi \ +// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple thumbv7-linux-gnueabi \ +// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple aarch64-linux-gnu \ +// RUN: -mstack-protector-guard-offset=1024 -mstack-protector-guard-reg=sp_el0 \ +// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=AARCH64 void foo(int*); void bar(int x) { int baz[x]; foo(baz); } -// CHECK: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]], [[ATTR3:![0-9]+]]} +// CHECK: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]]} // CHECK: [[ATTR1]] = !{i32 1, !"stack-protector-guard", !"sysreg"} -// CHECK: [[ATTR2]] = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"} -// CHECK: [[ATTR3]] = !{i32 1, !"stack-protector-guard-offset", i32 1024} -// CHECK-NONE-NOT: !"stack-protector-guard +// CHECK: [[ATTR2]] = !{i32 1, !"stack-protector-guard-offset", i32 1024} + +// AARCH64: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]], [[ATTR3:![0-9]+]]} +// AARCH64: [[ATTR1]] = !{i32 1, !"stack-protector-guard", !"sysreg"} +// AARCH64: [[ATTR2]] = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"} +// AARCH64: [[ATTR3]] = !{i32 1, !"stack-protector-guard-offset", i32 1024}