OSDN Git Service

2010-04-27 Kai Tietz <kai.tietz@onevision.com>
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Apr 2010 17:48:58 +0000 (17:48 +0000)
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Apr 2010 17:48:58 +0000 (17:48 +0000)
        * collect2.c (TARGET_64BIT): Redefine to target's default.
        * tlink.c: Likewise.
        * config/i386/cygming.h (USER_LABEL_PREFIX): Define
        dependent to TARGET_64BIT and USE_MINGW64_LEADING_UNDERSCORES.
        * config/i386/i386.h (CRT_CALL_STATIC_FUNCTION): Use
        for underscoring __USER_LABEL_PREFIX__.
        * config/i386/mingw-w64.h (SUB_LINK_ENTRY): New macro.
        (SUB_LINK_ENTRY32): New.
        (SUB_LINK_ENTRY64): New.
        (LINK_SPEC): Replace entry point spec by
        SUB_LINK_ENTRY.
        * config/i386/mingw32 (SUB_LINK_ENTRY32): New.
        (SUB_LINK_ENTRY64): New.
        (SUB_LINK_ENTRY): New.
        (LINK_SPEC): Use SUB_LINK_ENTRY instead of hard-coded entry-point.
        (DWARF2_UNWIND_INFO): Error out for use of dw2 unwind when
        x64 target is choosen.
        * config.in (USE_MINGW64_LEADING_UNDERSCORES): New.
        * configure: Regenerated.
        * configure.ac (leading-mingw64-underscores): Option added.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158791 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/collect2.c
gcc/config.in
gcc/config/i386/cygming.h
gcc/config/i386/i386.h
gcc/config/i386/mingw-w64.h
gcc/config/i386/mingw32.h
gcc/configure
gcc/configure.ac
gcc/tlink.c

index a6e7bf4..eba2ada 100644 (file)
@@ -1,3 +1,26 @@
+2010-04-27  Kai Tietz  <kai.tietz@onevision.com>
+
+       * collect2.c (TARGET_64BIT): Redefine to target's default.
+       * tlink.c: Likewise.
+       * config/i386/cygming.h (USER_LABEL_PREFIX): Define
+       dependent to TARGET_64BIT and USE_MINGW64_LEADING_UNDERSCORES.
+       * config/i386/i386.h (CRT_CALL_STATIC_FUNCTION): Use
+       for underscoring __USER_LABEL_PREFIX__.
+       * config/i386/mingw-w64.h (SUB_LINK_ENTRY): New macro.
+       (SUB_LINK_ENTRY32): New.
+       (SUB_LINK_ENTRY64): New.
+       (LINK_SPEC): Replace entry point spec by
+       SUB_LINK_ENTRY.
+       * config/i386/mingw32 (SUB_LINK_ENTRY32): New.
+       (SUB_LINK_ENTRY64): New.
+       (SUB_LINK_ENTRY): New.
+       (LINK_SPEC): Use SUB_LINK_ENTRY instead of hard-coded entry-point.
+       (DWARF2_UNWIND_INFO): Error out for use of dw2 unwind when
+       x64 target is choosen.
+       * config.in (USE_MINGW64_LEADING_UNDERSCORES): New.
+       * configure: Regenerated.
+       * configure.ac (leading-mingw64-underscores): Option added.
+
 2010-04-27  Jan Hubicka  <jh@suse.cz>
 
        * doc/invoke.texi (-fipa-profile): Document.
index ad66202..481f739 100644 (file)
@@ -35,6 +35,10 @@ along with GCC; see the file COPYING3.  If not see
 #  define SIGCHLD SIGCLD
 #endif
 
+/* TARGET_64BIT may be defined to use driver specific functionality. */
+#undef TARGET_64BIT
+#define TARGET_64BIT TARGET_64BIT_DEFAULT
+
 #ifndef LIBRARY_PATH_ENV
 #define LIBRARY_PATH_ENV "LIBRARY_PATH"
 #endif
index 9525625..7b04bbc 100644 (file)
 #endif
 
 
+/* Define if we should use leading underscore on 64 bit mingw targets */
+#ifndef USED_FOR_TARGET
+#undef USE_MINGW64_LEADING_UNDERSCORES
+#endif
+
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
index a726bb4..71a5d8d 100644 (file)
@@ -39,6 +39,11 @@ along with GCC; see the file COPYING3.  If not see
 #undef DEFAULT_ABI
 #define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
 
+#if ! defined (USE_MINGW64_LEADING_UNDERSCORES)
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX (TARGET_64BIT ? "" : "_")
+#endif
+
 #undef DBX_REGISTER_NUMBER
 #define DBX_REGISTER_NUMBER(n)                         \
   (TARGET_64BIT ? dbx64_register_map[n]                        \
index 4b83370..163cda1 100644 (file)
@@ -2148,9 +2148,12 @@ do {                                                                     \
 /* Switch to init or fini section via SECTION_OP, emit a call to FUNC,
    and switch back.  For x86 we do this only to save a few bytes that
    would otherwise be unused in the text section.  */
-#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)     \
-   asm (SECTION_OP "\n\t"                              \
-       "call " USER_LABEL_PREFIX #FUNC "\n"            \
+#define CRT_MKSTR2(VAL) #VAL
+#define CRT_MKSTR(x) CRT_MKSTR2(x)
+
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)             \
+   asm (SECTION_OP "\n\t"                                      \
+       "call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"     \
        TEXT_SECTION_ASM_OP);
 \f
 /* Print operand X (an rtx) in assembler syntax to file FILE.
index 8584082..3aafb93 100644 (file)
@@ -39,6 +39,8 @@ along with GCC; see the file COPYING3.  If not see
 #define ASM_SPEC "%{v:-v} %{n} %{T} %{Ym,*} %{Yd,*} \
  %{Wa,*:%*} %{m32:--32} %{m64:--64}"
 
+#undef SPEC_32
+#undef SPEC_64
 #if TARGET_64BIT_DEFAULT
 #define SPEC_32 "m32"
 #define SPEC_64 "!m32"
@@ -47,8 +49,21 @@ along with GCC; see the file COPYING3.  If not see
 #define SPEC_64 "m64"
 #endif
 
+#undef SUB_LINK_ENTRY32
+#undef SUB_LINK_ENTRY64
+#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
+#if defined(USE_MINGW64_LEADING_UNDERSCORES)
+#define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
+#else
+#define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
+#endif
+
+#undef SUB_LINK_SPEC
+#undef SUB_LINK_ENTRY
 #define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
+#define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}"
 
+#undef MULTILIB_DEFAULTS
 #if TARGET_64BIT_DEFAULT
 #define MULTILIB_DEFAULTS { "m64" }
 #else
@@ -61,5 +76,5 @@ along with GCC; see the file COPYING3.  If not see
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
-  %{shared|mdll: -e _DllMainCRTStartup@12 --enable-auto-image-base} \
+  %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
   %(shared_libgcc_undefs)"
index 2e877d8..e08ea1c 100644 (file)
@@ -47,6 +47,22 @@ along with GCC; see the file COPYING3.  If not see
     }                                                          \
   while (0)
 
+#undef SUB_LINK_ENTRY32
+#undef SUB_LINK_ENTRY64
+#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
+#if defined(USE_MINGW64_LEADING_UNDERSCORES)
+#define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
+#else
+#define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
+#endif
+
+#undef SUB_LINK_ENTRY
+#if TARGET_64BIT_DEFAULT
+#define SUB_LINK_ENTRY SUB_LINK_ENTRY64
+#else
+#define SUB_LINK_ENTRY SUB_LINK_ENTRY32
+#endif
+
 /* Override the standard choice of /usr/include as the default prefix
    to try when searching for header files.  */
 #undef STANDARD_INCLUDE_DIR
@@ -66,6 +82,10 @@ along with GCC; see the file COPYING3.  If not see
 /* Weak symbols do not get resolved if using a Windows dll import lib.
    Make the unwind registration references strong undefs.  */
 #if DWARF2_UNWIND_INFO
+/* DW2-unwind is just available for 32-bit mode.  */
+#if TARGET_64BIT_DEFAULT
+#error DW2 unwind is not available for 64-bit.
+#endif
 #define SHARED_LIBGCC_UNDEFS_SPEC \
  "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}"
 #else
@@ -81,7 +101,7 @@ along with GCC; see the file COPYING3.  If not see
   %{shared: %{mdll: %eshared and mdll are not compatible}} \
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
-  %{shared|mdll: -e _DllMainCRTStartup@12 --enable-auto-image-base} \
+  %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
   %(shared_libgcc_undefs)"
 
 /* Include in the mingw32 libraries with libgcc */
index 0515812..17effda 100755 (executable)
@@ -895,6 +895,7 @@ enable_initfini_array
 enable_sjlj_exceptions
 with_system_libunwind
 enable_secureplt
+enable_leading_mingw64_underscores
 enable_cld
 enable_win32_registry
 enable_static
@@ -1592,6 +1593,8 @@ Optional Features:
   --enable-sjlj-exceptions
                           arrange to use setjmp/longjmp exception handling
   --enable-secureplt      enable -msecure-plt by default for PowerPC
+  --enable-leading-mingw64-underscores
+                          Enable leading underscores on 64 bit mingw targets
   --enable-cld            enable -mcld by default for 32bit x86
   --disable-win32-registry
                           disable lookup of installation paths in the
@@ -10685,6 +10688,17 @@ if test "${enable_secureplt+set}" = set; then :
 fi
 
 
+# Check whether --enable-leading-mingw64-underscores was given.
+if test "${enable_leading_mingw64_underscores+set}" = set; then :
+  enableval=$enable_leading_mingw64_underscores;
+fi
+
+if  test x"$enable_leading_mingw64_underscores" = xyes ; then :
+
+$as_echo "#define USE_MINGW64_LEADING_UNDERSCORES 1" >>confdefs.h
+
+fi
+
 # Check whether --enable-cld was given.
 if test "${enable_cld+set}" = set; then :
   enableval=$enable_cld;
@@ -17094,7 +17108,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17097 "configure"
+#line 17111 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17200,7 +17214,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17203 "configure"
+#line 17217 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 67973b1..cd31f4e 100644 (file)
@@ -1568,6 +1568,14 @@ AC_ARG_ENABLE(secureplt,
 [  --enable-secureplt      enable -msecure-plt by default for PowerPC],
 [], [])
 
+AC_ARG_ENABLE(leading-mingw64-underscores,
+  AS_HELP_STRING([--enable-leading-mingw64-underscores],
+                 [Enable leading underscores on 64 bit mingw targets]),
+  [],[])
+AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ],
+  [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1,
+    [Define if we should use leading underscore on 64 bit mingw targets])])
+
 AC_ARG_ENABLE(cld,
 [  --enable-cld            enable -mcld by default for 32bit x86], [],
 [enable_cld=no])
index 1894c6c..7b58983 100644 (file)
@@ -32,6 +32,10 @@ along with GCC; see the file COPYING3.  If not see
 #include "collect2.h"
 #include "libiberty.h"
 
+/* TARGET_64BIT may be defined to use driver specific functionality. */
+#undef TARGET_64BIT
+#define TARGET_64BIT TARGET_64BIT_DEFAULT
+
 #define MAX_ITERATIONS 17
 
 /* Defined in the automatically-generated underscore.c.  */