This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [vta] revamp bootstrap-debug with -fcompare-debug, fix LIBCFLAGS uses
- From: Adam Nemet <anemet at caviumnetworks dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 07 Oct 2008 17:17:34 -0700
- Subject: Re: [vta] revamp bootstrap-debug with -fcompare-debug, fix LIBCFLAGS uses
- References: <orr66sakgi.fsf@oliva.athome.lsd.ic.unicamp.br>
Alexandre Oliva <aoliva@redhat.com> writes:
> Second, I found that LIBCFLAGS was not used consistently. IMHO, we
> should only use LIBCFLAGS for builds using the pre-installed host
> compiler. For target builds, we should use LIBCFLAGS_FOR_TARGET, and
> for host builds in in stage2+ I can see that it makes sense to use
> either STAGE_CFLAGS (being the preferred flags for GCC for that stage,
> without any of the magic flags required by the compiler used to build
> stage1) or CFLAGS_FOR_TARGET (being the preferred flags for the GCC
> built in the previous stage). I chose the former, for simplicity.
This is PR/37137. Can this part of the fix be merged to trunk now?
I think you also need to update install.texi. See my WIP patch for the same
issue.
Adam
Index: Makefile.tpl
===================================================================
--- Makefile.tpl (revision 140955)
+++ Makefile.tpl (working copy)
@@ -370,7 +370,11 @@ STAGE2_CFLAGS=$(BOOT_CFLAGS)
STAGE3_CFLAGS=$(BOOT_CFLAGS)
STAGE4_CFLAGS=$(BOOT_CFLAGS)
-STAGE1_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
+# Used during stage1 with host libraries.
+STAGE1_LIBCFLAGS=@stage1_cflags@
+# Used during stage1 with target libraries.
+STAGE1_CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)
+
STAGE2_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
STAGE3_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
STAGE4_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
@@ -945,9 +949,14 @@ all-stage[+id+]-[+prefix+][+module+]: co
cd [+subdir+]/[+module+] && \
$(MAKE) $(BASE_FLAGS_TO_PASS) \
CFLAGS="[+stage_cflags+]" CXXFLAGS="[+stage_cflags+]" \
- LIBCFLAGS="[+stage_libcflags+]" \
+ LIBCFLAGS="[+stage_libcflags+]"[+
+ IF (= (get "id") "1") +] \
+ CFLAGS_FOR_TARGET="$(STAGE1_CFLAGS_FOR_TARGET)" \
+ CXXFLAGS_FOR_TARGET="$(STAGE1_CFLAGS_FOR_TARGET)"[+
+ ELSE +] \
CFLAGS_FOR_TARGET="[+stage_libcflags+]" \
- CXXFLAGS_FOR_TARGET="[+stage_libcflags+]" [+args+] [+
+ CXXFLAGS_FOR_TARGET="[+stage_libcflags+]"[+
+ ENDIF +] [+args+] [+
IF prev +][+poststage1_args+][+ ENDIF prev
+] [+extra_make_flags+] \
$(TARGET-stage[+id+]-[+prefix+][+module+])
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi (revision 140955)
+++ gcc/doc/install.texi (working copy)
@@ -1848,7 +1848,7 @@ bootstrapped, you can use @code{CFLAGS_F
compilation flags, as for non-bootstrapped target libraries.
Again, if the native compiler miscompiles the stage1 compiler, you may
need to work around this by avoiding non-working parts of the stage1
-compiler. Use @code{STAGE1_LIBCFLAGS} to this end.
+compiler. Use @code{STAGE1_CFLAGS_FOR_TARGET} to this end.
If you used the flag @option{--enable-languages=@dots{}} to restrict
the compilers to be built, only those you've actually enabled will be