[PATCH] bootstrap, gnattools: Pass target sysroot flags to bootstrap compilers
Zhongteng Gui <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <SL2P216MB2271210112ECBF03F91610E1EFD12@SL2P216MB2271.KORP216.PROD.OUTLOOK.COM> |
When --with-build-sysroot is used, most target compiler invocations receive SYSROOT_CFLAGS_FOR_TARGET through XGCC_FLAGS_FOR_TARGET. GCC_FOR_TARGET and the post-stage1 C++ compiler are assembled separately, however, and therefore miss the configured sysroot. gnattools similarly constructs its native and rebuild CC and CXX commands directly. Without these flags, configure tests performed in later bootstrap stages can fail to find the target headers or startup files, reporting that the C++ compiler cannot create executables. Native gnattools can also invoke xg++ without the build sysroot when linking its programs, causing the target linker to fail to find crt2.o and default-manifest.o. Add SYSROOT_CFLAGS_FOR_TARGET to GCC_FOR_TARGET and the post-stage1 C++ compiler. Pass XGCC_FLAGS_FOR_TARGET to the compiler commands used by native and rebuilt gnattools. ChangeLog: PR bootstrap/126722 * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Add SYSROOT_CFLAGS_FOR_TARGET. (GCC_FOR_TARGET): Likewise. * Makefile.in: Regenerate. gnattools/ChangeLog: PR bootstrap/126722 * Makefile.in (TOOLS_FLAGS_TO_PASS_NATIVE): Add XGCC_FLAGS_FOR_TARGET to CC and CXX. (TOOLS_FLAGS_TO_PASS_RE): Likewise. Signed-off-by: Zhongteng Gui <[email protected]> --- Makefile.in | 3 ++- Makefile.tpl | 3 ++- gnattools/Makefile.in | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile.in b/Makefile.in index 110fa63c10c..74055159008 100644 --- a/Makefile.in +++ b/Makefile.in @@ -266,6 +266,7 @@ POSTSTAGE1_CXX_EXPORT = \ `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \ + $(SYSROOT_CFLAGS_FOR_TARGET) \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \ export CXX; \ @@ -715,7 +716,7 @@ CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ # variable is passed down to the gcc Makefile, where it is used to # build libgcc2.a. We define it here so that it can itself be # overridden on the command line. -GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ +GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(SYSROOT_CFLAGS_FOR_TARGET) CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ diff --git a/Makefile.tpl b/Makefile.tpl index a5ff44e3dbc..8d2131846b8 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -269,6 +269,7 @@ POSTSTAGE1_CXX_EXPORT = \ `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \ + $(SYSROOT_CFLAGS_FOR_TARGET) \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \ export CXX; \ @@ -622,7 +623,7 @@ CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ # variable is passed down to the gcc Makefile, where it is used to # build libgcc2.a. We define it here so that it can itself be # overridden on the command line. -GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ +GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(SYSROOT_CFLAGS_FOR_TARGET) CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in index 98f1f75bdcc..14c74ea6c53 100644 --- a/gnattools/Makefile.in +++ b/gnattools/Makefile.in @@ -81,8 +81,8 @@ CXX_LFLAGS = \ # Variables for gnattools, native TOOLS_FLAGS_TO_PASS_NATIVE= \ - "CC=../../xgcc -B../../" \ - "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ + "CC=../../xgcc -B../../ $(XGCC_FLAGS_FOR_TARGET)" \ + "CXX=../../xg++ -B../../ $(CXX_LFLAGS) $(XGCC_FLAGS_FOR_TARGET)" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS) $(PICFLAG)" \ "LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ "ADAFLAGS=$(ADAFLAGS)" \ @@ -99,8 +99,8 @@ TOOLS_FLAGS_TO_PASS_NATIVE= \ # Variables for regnattools TOOLS_FLAGS_TO_PASS_RE= \ - "CC=../../xgcc -B../../" \ - "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ + "CC=../../xgcc -B../../ $(XGCC_FLAGS_FOR_TARGET)" \ + "CXX=../../xg++ -B../../ $(CXX_LFLAGS) $(XGCC_FLAGS_FOR_TARGET)" \ "CFLAGS=$(CFLAGS) $(WARN_CFLAGS) $(PICFLAG)" \ "LDFLAGS=$(LDFLAGS) $(LD_PICFLAG)" \ "ADAFLAGS=$(ADAFLAGS)" \ -- 2.55.0.windows.3