mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 14:06:12 +00:00

Commit 56b038f887f3("[BPF][clang] Ignore stack protector options for BPF target") added a test for its corresponding functionality. Douglas Yung found that the test will fail with the release build buildbot due to different func argument patterns (from %msg to %0). This patch fixed the issue by using pattern [0-9a-z]+ which allows both %msg and %0.
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
// REQUIRES: bpf-registered-target
|
|
|
|
// RUN %clang -target bpf -S -emit-llvm -o - %s -fno-stack-protector 2>&1 \
|
|
// RUN | FileCheck -check-prefix=OFF -check-prefix=COMMON %s
|
|
|
|
// RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector 2>&1 \
|
|
// RUN: | FileCheck -check-prefix=ON -check-prefix=COMMON %s
|
|
|
|
// RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector-all 2>&1 \
|
|
// RUN: | FileCheck -check-prefix=ALL -check-prefix=COMMON %s
|
|
|
|
// RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector-strong 2>&1 \
|
|
// RUN: | FileCheck -check-prefix=STRONG -check-prefix=COMMON %s
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
|
|
|
int printf(const char * _Format, ...);
|
|
size_t strlen(const char *s);
|
|
char *strcpy(char *s1, const char *s2);
|
|
|
|
// OFF-NOT: warning
|
|
// ON: warning: ignoring '-fstack-protector'
|
|
// ALL: warning: ignoring '-fstack-protector-all'
|
|
// STRONG: warning: ignoring '-fstack-protector-strong'
|
|
// COMMON-SAME: option as it is not currently supported for target 'bpf'
|
|
|
|
// COMMON: define {{.*}}void @test1(ptr noundef %{{[0-9a-z]+}}) #[[A:.*]] {
|
|
void test1(const char *msg) {
|
|
char a[strlen(msg) + 1];
|
|
strcpy(a, msg);
|
|
printf("%s\n", a);
|
|
}
|
|
|
|
// COMMON-NOT: attributes #[[A]] = {{.*}} ssp
|