OSDN Git Service

2008-04-25 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / mingw32.h
index 890a096..19b57db 100644 (file)
@@ -164,6 +164,43 @@ do {                                                        \
 #undef TARGET_USE_JCR_SECTION
 #define TARGET_USE_JCR_SECTION 1
 
+#undef MINGW_ENABLE_EXECUTE_STACK
+#define MINGW_ENABLE_EXECUTE_STACK     \
+extern void __enable_execute_stack (void *);    \
+void         \
+__enable_execute_stack (void *addr)                                    \
+{                                                                      \
+  MEMORY_BASIC_INFORMATION b;                                          \
+  if (!VirtualQuery (addr, &b, sizeof(b)))                             \
+    abort ();                                                          \
+  VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \
+                 &b.Protect);                                          \
+}
+
+#undef ENABLE_EXECUTE_STACK
+#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK
+
+#define SUBTARGET_INIT_BUILTINS                                        \
+do {                                                           \
+  if (TARGET_64BIT_MS_ABI)                                     \
+    {                                                          \
+         /* These builtin functions have a different return    \
+            type (intptr_t) on 64-bit MS Windows.  */          \
+         disable_builtin_function ("execl");                   \
+         disable_builtin_function ("execlp");                  \
+         disable_builtin_function ("execle");                  \
+         disable_builtin_function ("execv");                   \
+         disable_builtin_function ("execvp");                  \
+         disable_builtin_function ("execve");                  \
+    }                                                          \
+  /* Second argument of MS scalb is long, not double. */       \
+  disable_builtin_function ("scalb");                          \
+} while (0)                                                     \
+
+#ifdef IN_LIBGCC2
+#include <windows.h>
+#endif
+
 #if !TARGET_64BIT
 #define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
 #endif