On Nov  8, 2018, JonY <10wa...@gmail.com> wrote:

> No, no. By quick I just mean using -Wl,--large-address-aware on an
> existing gcc install, nothing complex. Sorry about not making it clear.

Ah, good!

> I now understand the problem, thanks for the clarification about the
> patch. Patch is OK.

Thanks, here's what I'm installing (with comments indicating which
configuration each setting applies to, and why one of them won't work)


large-addr-aware for biarch non-w64 mingw32

for  gcc/ChangeLog

        * config/i386/mingw32.h (LINK_SPEC_LARGE_ADDR_AWARE): Adjust
        for non-w64 x86_64 biarch.
---
 gcc/config/i386/mingw32.h |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index c9d8a7a31f30..5759d8d16aef 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -114,11 +114,26 @@ 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
+#if ! MINGW_DEFAULT_LARGE_ADDR_AWARE
+/* This is used without --enable-large-address-aware.  */
+# define LINK_SPEC_LARGE_ADDR_AWARE ""
+#elif ! TARGET_BI_ARCH
+/* This is used on i686-pc-mingw32 with --enable-large-address-aware.  */
 # define LINK_SPEC_LARGE_ADDR_AWARE \
   "%{!shared:%{!mdll:--large-address-aware}}"
+#elif TARGET_64BIT_DEFAULT
+/* This is used on x86_64-pc-mingw32 with --enable-large-address-aware.
+   ??? It probably doesn't work, because the linker emulation defaults
+   to i386pep, the 64-bit mode that does not support
+   --large-address-aware, and x86_64-pc-mingw32 does not override the
+   emulation to i386pe for -m32, unlike x86_64-w64-mingw32.  */
+# define LINK_SPEC_LARGE_ADDR_AWARE \
+  "%{!shared:%{!mdll:%{m32:--large-address-aware}}}"
 #else
-# define LINK_SPEC_LARGE_ADDR_AWARE ""
+/* This would only be used if someone introduced a biarch
+   configuration that defaulted to 32-bit.  */
+# define LINK_SPEC_LARGE_ADDR_AWARE \
+  "%{!shared:%{!mdll:%{!m64:--large-address-aware}}}"
 #endif
 
 #define LINK_SPEC "%{mwindows:--subsystem windows} \


-- 
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
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

Reply via email to