https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81878

--- Comment #40 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
> In most practical cases -B../../ is just redundant with $(CXX).  It's only 
> when you configure like Richard that you may run into issues, but then we can 
> assume that we're on Linux so the paths are OK I think.

Ah ok, I'll update to trunk and run a bootstrap today then and submit a patch
tomorrow. Thanks!

--- Comment #41 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Author: tnfchris
Date: Mon Oct 29 09:45:50 2018
New Revision: 265583

URL: https://gcc.gnu.org/viewcvs?rev=265583&root=gcc&view=rev
Log:
Fix mingw-w64 Ada native bootstrap (PR81878).

Due to the changes in PR81878 builds of GCC8 and trunk are impossible
with Ada enabled[1][2].

The reason the patch breaks the bootstrap is due to how gnatlink receives it's
arguments.

gnatlink is usually invoked as

        $(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
          --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)

so it passes $(CC) and $(GCC_LINK) as quoted arguments to the program.
Because of this quotation the msys2 shell does not translate any paths in
$(CC) and $(GCC_LINK) from their Unix version to their Windows version.

Furthermore because there are multiple paths in the values separated by space
and because the paths often contain a prefix like -L (e.g. -L/f/foo) we can't
use `fix_srcfile_path` to fix this.

An alternative solution would have been to create a stub program that echos the
commandline options it receives back, and calling this program with $(CC) and
$(GCC_LINK)
unquoted to get them translated.  However this was a bit more invasive.

So instead for native compilations we add -B../../ such that it picks up the
lto plugin
from the previous built compiler.  Since it's native there shouldn't be a
mismatch here.

[1] https://github.com/Alexpux/MINGW-packages/pull/3877#issuecomment-408651809
[2] https://gcc.gnu.org/ml/gcc/2018-07/msg00410.html

gnattools/ChangeLog:

        PR ada/81878
        * Makefile.in (TOOLS_FLAGS_TO_PASS_NATIVE): Add -B ../../.


Modified:
    trunk/gnattools/ChangeLog
    trunk/gnattools/Makefile.in

Reply via email to