From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125832 invoked by alias); 9 Oct 2018 05:49:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 125819 invoked by uid 89); 9 Oct 2018 05:49:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=free!, Free!, userspace X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Oct 2018 05:49:33 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5DB165614E; Tue, 9 Oct 2018 01:49:31 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id pTBK2TRdJPe5; Tue, 9 Oct 2018 01:49:31 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id BCEAF5608A; Tue, 9 Oct 2018 01:49:30 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTP id w994xJf4488742; Tue, 9 Oct 2018 01:59:19 -0300 From: Alexandre Oliva To: Joseph Myers Cc: Jonathan Yong <10walls@gmail.com>, Subject: Re: introduce --enable-mingw-full32 to default to --large-address-aware References: Date: Tue, 09 Oct 2018 06:38:00 -0000 In-Reply-To: (Joseph Myers's message of "Fri, 5 Oct 2018 16:09:56 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-10/txt/msg00479.txt.bz2 On Oct 5, 2018, Joseph Myers wrote: > A new configure option needs documenting in install.texi. Ah, yes, thanks for the reminder. On Oct 6, 2018, JonY <10walls@gmail.com> wrote: > They're both OK as far as I can see. I just don't like the configure > name implying all 32bit pointers are used by userspace. Perhaps just > --enable-large-address-aware? That might suggest the flag affects all targets, including Cygwin, so I'm following the existing (undocumented) practice in suggesting --enable-mingw-large-address-aware instead. Please let me know if you'd rather not have mingw in the option name, and for it to affect (in the --disable form) the Cygwin target as well. > Be sure to also update the documentation as Joseph says. *nod*, thanks. Here's the patch I'm testing now. Ok to install? Add a configure knob for mingw32 and 64 toolchains to default passing --large-address-aware to the linker, when creating 32-bit binaries. -Wl,--disable-large-address-aware can still reverse its effects. for gcc/ChangeLog * configure.ac: Introduce --enable-mingw-large-address-aware to define MINGW_DEFAULT_LARGE_ADDR_AWARE. * doc/install.texi: Document it. * configure, config.in: Rebuilt. * config/i386/mingw32.h (LINK_SPEC_LARGE_ADDR_AWARE): Define, based on MINGW_DEFAULT_LARGE_ADDR_AWARE. (LINK_SPEC): Insert it. * config/i386/mingw-264.h: Likewise. --- gcc/config.in | 6 ++++++ gcc/config/i386/mingw-w64.h | 9 +++++++++ gcc/config/i386/mingw32.h | 8 ++++++++ gcc/configure | 18 ++++++++++++++++-- gcc/configure.ac | 7 +++++++ gcc/doc/install.texi | 8 ++++++++ 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 4db8aa1ea154..44c3d04ab83c 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1986,6 +1986,12 @@ #endif +/* Define if we should link with --large-address-aware by default */ +#ifndef USED_FOR_TARGET +#undef MINGW_DEFAULT_LARGE_ADDR_AWARE +#endif + + /* Value to set mingw's _dowildcard to. */ #ifndef USED_FOR_TARGET #undef MINGW_DOWILDCARD diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h index 484dc7a9e9f2..00b3f042a36c 100644 --- a/gcc/config/i386/mingw-w64.h +++ b/gcc/config/i386/mingw-w64.h @@ -81,6 +81,14 @@ along with GCC; see the file COPYING3. If not see #define MULTILIB_DEFAULTS { "m32" } #endif +#undef LINK_SPEC_LARGE_ADDR_AWARE +#if MINGW_DEFAULT_LARGE_ADDR_AWARE +# define LINK_SPEC_LARGE_ADDR_AWARE \ + "%{!shared:%{!mdll:%{" SPEC_32 ":--large-address-aware}}}" +#else +# define LINK_SPEC_LARGE_ADDR_AWARE "" +#endif + #undef LINK_SPEC #define LINK_SPEC SUB_LINK_SPEC " %{mwindows:--subsystem windows} \ %{mconsole:--subsystem console} \ @@ -88,4 +96,5 @@ along with GCC; see the file COPYING3. If not see %{shared: --shared} %{mdll:--dll} \ %{static:-Bstatic} %{!static:-Bdynamic} \ %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ + " LINK_SPEC_LARGE_ADDR_AWARE "\ %(shared_libgcc_undefs)" diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index a66010894208..c9d8a7a31f30 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -114,12 +114,20 @@ along with GCC; see the file COPYING3. If not see #define SUBTARGET_EXTRA_SPECS \ { "shared_libgcc_undefs", SHARED_LIBGCC_UNDEFS_SPEC } +#if MINGW_DEFAULT_LARGE_ADDR_AWARE +# define LINK_SPEC_LARGE_ADDR_AWARE \ + "%{!shared:%{!mdll:--large-address-aware}}" +#else +# define LINK_SPEC_LARGE_ADDR_AWARE "" +#endif + #define LINK_SPEC "%{mwindows:--subsystem windows} \ %{mconsole:--subsystem console} \ %{shared: %{mdll: %eshared and mdll are not compatible}} \ %{shared: --shared} %{mdll:--dll} \ %{static:-Bstatic} %{!static:-Bdynamic} \ %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ + " LINK_SPEC_LARGE_ADDR_AWARE "\ %(shared_libgcc_undefs)" /* Include in the mingw32 libraries with libgcc */ diff --git a/gcc/configure b/gcc/configure index 9fb0eb57a8a1..17eb8d9a6154 100755 --- a/gcc/configure +++ b/gcc/configure @@ -927,6 +927,7 @@ enable_sjlj_exceptions with_gcc_major_version_only enable_secureplt enable_mingw_wildcard +enable_mingw_large_address_aware enable_leading_mingw64_underscores enable_cld enable_frame_pointer @@ -1644,6 +1645,8 @@ Optional Features: --enable-secureplt enable -msecure-plt by default for PowerPC --enable-mingw-wildcard Set whether to expand wildcard on command-line. Default to platform configuration + --enable-mingw-large-address-aware + Link mingw executables with --large-address-aware --enable-leading-mingw64-underscores enable leading underscores on 64 bit mingw targets --enable-cld enable -mcld by default for 32bit x86 @@ -12005,6 +12008,17 @@ _ACEOF fi +# Check whether --enable-mingw-large-address-aware was given. +if test "${enable_mingw_large_address_aware+set}" = set; then : + enableval=$enable_mingw_large_address_aware; +fi + +if test x"$enable_mingw_large_address_aware" = xyes; then : + +$as_echo "#define MINGW_DEFAULT_LARGE_ADDR_AWARE 1" >>confdefs.h + +fi + # Check whether --enable-leading-mingw64-underscores was given. if test "${enable_leading_mingw64_underscores+set}" = set; then : enableval=$enable_leading_mingw64_underscores; @@ -18463,7 +18477,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18466 "configure" +#line 18480 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18569,7 +18583,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18572 "configure" +#line 18586 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index ca51cdf751b9..5d2a35ed780c 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1829,6 +1829,13 @@ AS_IF([test x"$enable_mingw_wildcard" != xplatform ], $(test x"$enable_mingw_wildcard" = xno; echo $?), [Value to set mingw's _dowildcard to.])]) +AC_ARG_ENABLE(mingw-large-address-aware, +[AS_HELP_STRING([--enable-mingw-large-address-aware], + [Link mingw executables with --large-address-aware])]) +AS_IF([test x"$enable_mingw_large_address_aware" = xyes], + [AC_DEFINE([MINGW_DEFAULT_LARGE_ADDR_AWARE], 1, + [Define if we should link mingw executables with --large-address-aware])]) + AC_ARG_ENABLE(leading-mingw64-underscores, AS_HELP_STRING([--enable-leading-mingw64-underscores], [enable leading underscores on 64 bit mingw targets]), diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 61ab97ee3707..d03ee31f4810 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1729,6 +1729,14 @@ Using the GNU Compiler Collection (GCC)}, See ``i386 and x86-64 Options'' in the main manual @end ifhtml +@item --enable-mingw-large-address-aware +The @option{--enable-mingw-large-address-aware} option arranges for +MinGW executables to be linked using the @option{--large-address-aware} +option, that enables the use of more than 2GB of memory. If GCC is +configured with this option, its effects can be reversed by passing the +@option{-Wl,--disable-large-address-aware} option to the so-configured +compiler driver. + @item --enable-win32-registry @itemx --enable-win32-registry=@var{key} @itemx --disable-win32-registry -- Alexandre Oliva, freedom fighter https://FSFLA.org/blogs/lxo Be the change, be Free! FSF Latin America board member GNU Toolchain Engineer Free Software Evangelist