1 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s 2 // NOSSP: define {{.*}}void @test1(i8* %msg) #0 { 3 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s 4 // WITHSSP: define {{.*}}void @test1(i8* %msg) #0 { 5 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s 6 // SSPSTRONG: define {{.*}}void @test1(i8* %msg) #0 { 7 // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s 8 // SSPREQ: define {{.*}}void @test1(i8* %msg) #0 { 9 // RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s 10 // SAFESTACK: define {{.*}}void @test1(i8* %msg) #0 { 11 12 typedef __SIZE_TYPE__ size_t; 13 14 int printf(const char * _Format, ...); 15 size_t strlen(const char *s); 16 char *strcpy(char *s1, const char *s2); 17 18 void test1(const char *msg) { 19 char a[strlen(msg) + 1]; 20 strcpy(a, msg); 21 printf("%s\n", a); 22 } 23 24 // NOSSP: attributes #{{.*}} = { nounwind{{.*}} } 25 26 // WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} } 27 28 // SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} } 29 30 // SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} } 31 32 // SAFESTACK: attributes #{{.*}} = { nounwind safestack{{.*}} } 33