This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch i386]: Disable builtins exec(l/v) for x86_64-pc-mingw* target
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Kai Tietz <Kai dot Tietz at onevision dot com>
- Cc: Danny Smith <dansmister at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Kai Tietz <ktietz70 at googlemail dot com>
- Date: Fri, 25 Apr 2008 18:40:43 +0200
- Subject: Re: [patch i386]: Disable builtins exec(l/v) for x86_64-pc-mingw* target
- References: <OFBED1C975.48A9AC7C-ONC1257436.00397818-C1257436.003AB773@onevision.de>
Kai Tietz wrote:
2008-04-25 Kai Tietz <kai.tietz@onevision.com>
* config/i386/mingw32.h (SUBTARGET_INIT_BUILTINS): New.
* config/i386/i386.c (ix86_init_builtins): Use
SUBTARGET_INIT_BUILTINS.
Uros, my question is, shouldn't we add to i386.h at least an '#undef
SUBTARGET_INIT_BUILTINS'? This would show to other i386 targets, that
there is a way to customize the builtins for there purpose.
This is the same approach as rs6000 has for its darwin subtarget. I
think we can adopt the same approach here, so it is OK for the mainline
(but please add whitespace changes as described below).
------------------------------------------------------------------------
Index: gcc/gcc/config/i386/i386.c
===================================================================
--- gcc.orig/gcc/config/i386/i386.c
+++ gcc/gcc/config/i386/i386.c
@@ -19806,6 +19806,9 @@ ix86_init_builtins (void)
{
if (TARGET_MMX)
ix86_init_mmx_sse_builtins ();
One line of vertical space here.
+#ifdef SUBTARGET_INIT_BUILTINS
+ SUBTARGET_INIT_BUILTINS;
+#endif
}
/* Errors in the source file can cause expand_expr to return const0_rtx
Index: gcc/gcc/config/i386/mingw32.h
===================================================================
--- gcc.orig/gcc/config/i386/mingw32.h
+++ gcc/gcc/config/i386/mingw32.h
@@ -180,6 +180,24 @@ __enable_execute_stack (void *addr)
#undef ENABLE_EXECUTE_STACK
#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK
+#undef SUBTARGET_INIT_BUILTINS
+#define SUBTARGET_INIT_BUILTINS \
+ do { \
No need for #undef, since this will never be defined in the top level.
This #define is for subtargets and these are mutually exclusive.
Please also fix indentation for "do {". It should start at the beginning
of the line.
+ 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>
Thanks,
Uros.