Files
llvm-mingw/patches/mingw-0001.patch
T

37 lines
1.3 KiB
Diff

From 077f2318a219db191588d0ab00df58bb694c2931 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Fri, 5 Aug 2016 20:09:41 -0700
Subject: [PATCH] Handle __CTOR_LIST__ for clang
diff --git a/mingw-w64-crt/crt/crtbegin.c b/mingw-w64-crt/crt/crtbegin.c
index 39c0d85..231dafc 100644
--- a/mingw-w64-crt/crt/crtbegin.c
+++ b/mingw-w64-crt/crt/crtbegin.c
@@ -4,3 +4,7 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#ifdef __clang__
+__attribute__ (( __section__ (".ctors"), __used__ , aligned(sizeof(void *)))) const void * __CTOR_LIST__ = (void *) -1;
+__attribute__ (( __section__ (".dtors"), __used__ , aligned(sizeof(void *)))) const void * __DTOR_LIST__ = (void *) -1;
+#endif
diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index ae37e0f..ad91f25 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -60,6 +60,11 @@ extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[];
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
+#ifdef __clang__
+extern _CRTALLOC(".ctors$zzz") void *__CTOR_END__[] = {(void*)0};
+extern _CRTALLOC(".dtors$zzz") void *__DTOR_END__[] = {(void*)0};
+#endif
+
/* TLS initialization hook. */
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
--
2.8.3