From d4eb0305b8581368fb5f9ed88dd501e13d1cdd3e Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 29 Oct 2018 09:45:50 +0000 Subject: [PATCH] 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 ../../. From-SVN: r265583 --- gnattools/ChangeLog | 5 +++++ gnattools/Makefile.in | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index 71a49e878f0..4bd70ee877f 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,8 @@ +2018-10-29 Tamar Christina + + PR ada/81878 + * Makefile.in (TOOLS_FLAGS_TO_PASS_NATIVE): Add -B ../../. + 2017-08-17 Richard Biener PR ada/81878 diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in index d19147fe5d7..8a98a2d0b18 100644 --- a/gnattools/Makefile.in +++ b/gnattools/Makefile.in @@ -70,9 +70,12 @@ INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada # Variables for gnattools, native +# Due to Windows path translations (See PR ada/81878) we need to add +# -B../../ to the compiler paths as a workaround for that $(CXX) contains +# Unix style paths that won't be translated by the runtime. TOOLS_FLAGS_TO_PASS_NATIVE= \ "CC=../../xgcc -B../../" \ - "CXX=$(CXX)" \ + "CXX=$(CXX) -B../../" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "ADAFLAGS=$(ADAFLAGS)" \ -- 2.30.2