2010-01-01 05:34:51 -05:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
|
2015-07-05 10:23:59 -04:00
|
|
|
// NOSSP: define {{.*}}void @test1(i8* %msg) #0 {
|
2010-01-01 05:34:51 -05:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
|
2015-07-05 10:23:59 -04:00
|
|
|
// WITHSSP: define {{.*}}void @test1(i8* %msg) #0 {
|
2014-11-24 04:15:30 -05:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s
|
2015-07-05 10:23:59 -04:00
|
|
|
// SSPSTRONG: define {{.*}}void @test1(i8* %msg) #0 {
|
2014-11-24 04:15:30 -05:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s
|
2015-07-05 10:23:59 -04:00
|
|
|
// SSPREQ: define {{.*}}void @test1(i8* %msg) #0 {
|
2015-06-21 10:00:56 -04:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s
|
2015-07-05 10:23:59 -04:00
|
|
|
// SAFESTACK: define {{.*}}void @test1(i8* %msg) #0 {
|
2013-04-08 14:45:10 -04:00
|
|
|
|
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
2009-07-04 09:58:54 -04:00
|
|
|
|
2009-10-14 14:03:49 -04:00
|
|
|
int printf(const char * _Format, ...);
|
2013-04-08 14:45:10 -04:00
|
|
|
size_t strlen(const char *s);
|
|
|
|
|
char *strcpy(char *s1, const char *s2);
|
2009-07-04 09:58:54 -04:00
|
|
|
|
|
|
|
|
void test1(const char *msg) {
|
|
|
|
|
char a[strlen(msg) + 1];
|
|
|
|
|
strcpy(a, msg);
|
|
|
|
|
printf("%s\n", a);
|
|
|
|
|
}
|
2013-04-08 14:45:10 -04:00
|
|
|
|
|
|
|
|
// NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
|
|
|
|
|
|
|
|
|
|
// WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
|
|
|
|
|
|
2014-11-24 04:15:30 -05:00
|
|
|
// SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} }
|
|
|
|
|
|
2013-04-08 14:45:10 -04:00
|
|
|
// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
|
2015-06-21 10:00:56 -04:00
|
|
|
|
|
|
|
|
// SAFESTACK: attributes #{{.*}} = { nounwind safestack{{.*}} }
|