jeremyd2019 28b3190053
[LLVM][Cygwin] Enable conditions that are shared with MinGW (#149638)
Cygwin and MinGW share the auto import behavior that could result in
__stack_check_guard being non-dso-local. Allow windres to assume a
Cygwin target as well as a MinGW one, so defines like _WIN32 would not
be present on Cygwin.
2025-07-29 10:01:04 -07:00

33 lines
1.3 KiB
LLVM

; RUN: llc -mtriple=x86_64-w64-mingw32 < %s -o - | FileCheck --check-prefix=MINGW %s
; RUN: llc -mtriple=x86_64-pc-cygwin < %s -o - | FileCheck --check-prefix=MINGW %s
; RUN: llc -mtriple=x86_64-pc-windows-itanium < %s -o - | FileCheck --check-prefix=MSVC %s
; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s -o - | FileCheck --check-prefix=MSVC %s
; RUN: llc -mtriple=i686-w64-mingw32 < %s -o - | FileCheck --check-prefix=MINGW %s
; RUN: llc -mtriple=i686-pc-cygwin < %s -o - | FileCheck --check-prefix=MINGW %s
declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
declare dso_local void @other(ptr)
declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
define dso_local void @func() sspstrong {
entry:
; MINGW-LABEL: func:
; MINGW: mov{{l|q}} .refptr.[[PREFIX:_?]]__stack_chk_guard{{(\(%rip\))?}}, [[REG:%[a-z]+]]
; MINGW: mov{{l|q}} ([[REG]])
; MINGW: call{{l|q}} [[PREFIX]]other
; MINGW: mov{{l|q}} ([[REG]])
; MINGW: call{{l|q}} [[PREFIX]]__stack_chk_fail
; MSVC-LABEL: func:
; MSVC: mov{{l|q}} __security_cookie
; MSVC: callq other
; MSVC: callq __security_check_cookie
; MSVC: .seh_endproc
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c)
call void @other(ptr nonnull %c)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c)
ret void
}