tsan: add missing function for windows
authorDmitry Vyukov <dvyukov@google.com>
Tue, 6 Nov 2012 13:25:05 +0000 (13:25 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Tue, 6 Nov 2012 13:25:05 +0000 (13:25 +0000)
llvm-svn: 167454

compiler-rt/lib/tsan/go/tsan_go.cc

index eca6cae..ccedc64 100644 (file)
@@ -191,5 +191,39 @@ void __tsan_finalizer_goroutine(int goid) {
   ThreadFinalizerGoroutine(thr);
 }
 
+#ifdef _WIN32
+// MinGW gcc emits calls to the function.
+void ___chkstk_ms(void) {
+// The implementation must be along the lines of:
+// .code64
+// PUBLIC ___chkstk_ms
+//     //cfi_startproc()
+// ___chkstk_ms:
+//     push rcx
+//     //cfi_push(%rcx)
+//     push rax
+//     //cfi_push(%rax)
+//     cmp rax, PAGE_SIZE
+//     lea rcx, [rsp + 24]
+//     jb l_LessThanAPage
+// .l_MoreThanAPage:
+//     sub rcx, PAGE_SIZE
+//     or rcx, 0
+//     sub rax, PAGE_SIZE
+//     cmp rax, PAGE_SIZE
+//     ja l_MoreThanAPage
+// .l_LessThanAPage:
+//     sub rcx, rax
+//     or [rcx], 0
+//     pop rax
+//     //cfi_pop(%rax)
+//     pop rcx
+//     //cfi_pop(%rcx)
+//     ret
+//     //cfi_endproc()
+// END
+}
+#endif
+
 }  // extern "C"
 }  // namespace __tsan