1; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %s | FileCheck --check-prefix=CHECK-TLS-FS-40 %s 2; RUN: llc -mtriple=x86_64-pc-linux-gnu -stack-protector-guard=tls -o - < %s | FileCheck --check-prefix=CHECK-TLS-FS-40 %s 3; RUN: llc -mtriple=x86_64-pc-linux-gnu -stack-protector-guard=global -o - < %s | FileCheck --check-prefix=CHECK-GLOBAL %s 4; RUN: llc -mtriple=x86_64-pc-linux-gnu -stack-protector-guard-reg=fs -o - < %s | FileCheck --check-prefix=CHECK-TLS-FS-40 %s 5; RUN: llc -mtriple=x86_64-pc-linux-gnu -stack-protector-guard-reg=gs -o - < %s | FileCheck --check-prefix=CHECK-GS %s 6; RUN: llc -mtriple=x86_64-pc-linux-gnu -stack-protector-guard-offset=20 -o - < %s | FileCheck --check-prefix=CHECK-OFFSET %s 7; RUN: llc -mtriple=x86_64-pc-linux-gnu -stack-protector-guard-offset=-20 -o - < %s | FileCheck --check-prefix=CHECK-NEGATIVE-OFFSET %s 8 9; CHECK-TLS-FS-40: movq %fs:40, %rax 10; CHECK-TLS-FS-40: movq %fs:40, %rax 11; CHECK-TLS-FS-40-NEXT: cmpq 16(%rsp), %rax 12; CHECK-TLS-FS-40-NEXT: jne .LBB0_2 13; CHECK-TLS-FS-40: .LBB0_2: 14; CHECK-TLS-FS-40-NEXT: .cfi_def_cfa_offset 32 15; CHECK-TLS-FS-40-NEXT: callq __stack_chk_fail 16 17; CHECK-GS: movq %gs:40, %rax 18; CHECK-GS: movq %gs:40, %rax 19; CHECK-GS-NEXT: cmpq 16(%rsp), %rax 20; CHECK-GS-NEXT: jne .LBB0_2 21; CHECK-GS: .LBB0_2: 22; CHECK-GS-NEXT: .cfi_def_cfa_offset 32 23; CHECK-GS-NEXT: callq __stack_chk_fail 24 25; CHECK-OFFSET: movq %fs:20, %rax 26; CHECK-OFFSET: movq %fs:20, %rax 27; CHECK-OFFSET-NEXT: cmpq 16(%rsp), %rax 28; CHECK-OFFSET-NEXT: jne .LBB0_2 29; CHECK-OFFSET: .LBB0_2: 30; CHECK-OFFSET-NEXT: .cfi_def_cfa_offset 32 31; CHECK-OFFSET-NEXT: callq __stack_chk_fail 32 33; CHECK-NEGATIVE-OFFSET: movl $4294967276, %eax # imm = 0xFFFFFFEC 34; CHECK-NEGATIVE-OFFSET: movq %fs:(%rax), %rcx 35; CHECK-NEGATIVE-OFFSET: movq %fs:(%rax), %rax 36; CHECK-NEGATIVE-OFFSET-NEXT: cmpq 16(%rsp), %rax 37; CHECK-NEGATIVE-OFFSET-NEXT: jne .LBB0_2 38; CHECK-NEGATIVE-OFFSET: .LBB0_2: 39; CHECK-NEGATIVE-OFFSET-NEXT: .cfi_def_cfa_offset 32 40; CHECK-NEGATIVE-OFFSET-NEXT: callq __stack_chk_fail 41 42; CHECK-GLOBAL: movq __stack_chk_guard(%rip), %rax 43; CHECK-GLOBAL: movq __stack_chk_guard(%rip), %rax 44; CHECK-GLOBAL-NEXT: cmpq 16(%rsp), %rax 45; CHECK-GLOBAL-NEXT: jne .LBB0_2 46; CHECK-GLOBAL: .LBB0_2: 47; CHECK-GLOBAL-NEXT: .cfi_def_cfa_offset 32 48; CHECK-GLOBAL-NEXT: callq __stack_chk_fail 49 50; ModuleID = 't.c' 51@.str = private unnamed_addr constant [14 x i8] c"stackoverflow\00", align 1 52@a = dso_local local_unnamed_addr global i8* null, align 8 53 54; Function Attrs: nounwind sspreq uwtable writeonly 55define dso_local i32 @main() local_unnamed_addr #0 { 56entry: 57 %array = alloca [5 x i8], align 1 58 %0 = getelementptr inbounds [5 x i8], [5 x i8]* %array, i64 0, i64 0 59 call void @llvm.lifetime.start.p0i8(i64 5, i8* nonnull %0) #2 60 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 dereferenceable(14) %0, i8* nonnull align 1 dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 14, i1 false) #2 61 store i8* %0, i8** @a, align 8 62 call void @llvm.lifetime.end.p0i8(i64 5, i8* nonnull %0) #2 63 ret i32 0 64} 65 66; Function Attrs: argmemonly nounwind willreturn 67declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1 68 69; Function Attrs: argmemonly nounwind willreturn 70declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1 71 72; Function Attrs: argmemonly nounwind willreturn 73declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 74 75attributes #0 = { nounwind sspreq uwtable writeonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } 76attributes #1 = { argmemonly nounwind willreturn } 77attributes #2 = { nounwind } 78