On 11/07/2018 08:34 AM, Alexandre Oliva wrote: > On Nov 1, 2018, JonY wrote: > >> Looks like it causes an error on 64bit: >> /usr/libexec/gcc/x86_64-w64-mingw32/ld: unrecognized option >> '--large-address-aware' > > What does? The patch I suggested? The current trunk? > > What was the command in this case? How was the toolchain configured? > > > I've been looking into this, getting progressively puzzled, though I > actually managed to duplicated the problem you mentioned, but only on > x86_64-mingw32, NOT on x86_64-w64-mingw32. > > No it's just a quick test to see how x86_64-w64-mingw32 reacts to --large-address-aware, it doesn't play well. > Here's what I found out in my investigation: > > configured for i686-mingw32, GNU ld supports only the i386pe emulation, > that supports the --large-address-aware flag. > > Configured for x86_64-*-mingw32, it supports i386pe, but it defaults to > i386pep, the 64-bit binary format, that does NOT support > --large-address-aware. > > x86_64-w64-mingw32 passes -mi386pe or -mi386pep to the linker, depending > on -m32 or -m64, so the code to pass --large-address-aware to link -m32 > binaries in mingw-w64.h looks correct to me. But x86_64-mingw32 does > NOT use that: it uses the LINK_SPEC from mingw32.h, so it doesn't > specify the emulation, ever. That seems awfully broken to me. If you > ask for a 32-bit binary, using the default 64-bit linker format is > unlikely to produce the desired results. > > Is x86_64-mingw32 really supposed to be a usable target name? It might > even work as a 64-bit only target, but I don't see how its biarch > support could possibly be functional. > > If it is to be usable, is it really supposed to be different from > x86_64-w64-mingw32? Using mingw-w64.h besides mingw32.h would fix the > biarch problems, but perhaps that's not desired for other reasons. > > Fixing that is way beyond my knowledge or interest on Windows-based > platforms, but given clarification as to whether x86_64-mingw32 is > supposed to support biarch at all, I might be able to fix the > implementation of --enable-large-address-aware there. > > As for the problem you reported on x86_64-w64-mingw32, I'm afraid I'll > need some more information to be able to duplicate that and try to fix > it. > > Thanks, > x86_64-mingw32 is not used as far as I know, only with "w64" or "pc". The "w64" carries a special meaning to gcc dating back to the early 64bit port. It basically tells gcc to use mingw-w64 specific features that are not found on the regular mingw.org CRT at the time. This might be affecting the "pc" vendor build, can you check x86_64-pc-mingw32 just to see if it is affected? Thanks.