This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Re-use cc1-checksum.c for stage-final
- From: Richard Biener <rguenther at suse dot de>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 Apr 2016 13:36:28 +0200 (CEST)
- Subject: Re: [PATCH] Re-use cc1-checksum.c for stage-final
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1604281043180 dot 13384 at t29 dot fhfr dot qr> <e4aa1967-6af2-e6cf-aa1e-632e9f41a097 at redhat dot com>
On Thu, 28 Apr 2016, Jeff Law wrote:
> On 04/28/2016 02:49 AM, Richard Biener wrote:
> >
> > The following prototype patch re-uses cc1-checksum.c from the
> > previous stage when compiling stage-final. This eventually
> > allows to compare cc1 from the last two stages to fix the
> > lack of a true comparison when doing LTO bootstrap (it
> > compiles LTO bytecode from the compile-stage there, not the
> > final optimization result).
> >
> > Bootstrapped on x86_64-unknown-linux-gnu.
> >
> > When stripping gcc/cc1 and prev-gcc/cc1 after the bootstrap
> > they now compare identical (with LTO bootstrap it should
> > not require stripping as that doesn't do a bootstrap-debug AFAIK).
> >
> > Is sth like this acceptable? (consider it also done for cp/Make-lang.in)
> >
> > In theory we can compare all stage1 languages but I guess comparing
> > the required ones for a LTO bootstrap, cc1, cc1plus and lto1 would
> > be sufficient (or even just comparing one binary in which case
> > comparing lto1 would not require any patches).
> >
> > This also gets rid of the annoying warning that cc1-checksum.o
> > differs (obviously).
> >
> > Thanks,
> > Richard.
> >
> > 2016-04-28 Richard Biener <rguenther@suse.de>
> >
> > c/
> > * Make-lang.in (cc1-checksum.c): For stage-final re-use
> > the checksum from the previous stage.
> I won't object if you add a comment into the fragment indicating why you're
> doing this.
So the following is a complete patch (not considering people may
add objc or obj-c++ to stage1 languages). Build with --disable-bootstrap,
bootstrapped and profilebootstrapped with verifying it works as
intended (looks like we don't compare with profiledbootstrap - huh,
we're building stagefeedback only once)
Ok for trunk?
Step 2 will now be to figure out how to also compare cc1 (for example)
when using bootstrap-lto ... (we don't want to do this unconditionally
as it is a waste of time when the objects are not only LTO bytecode).
Thanks,
Richard.
2016-04-29 Richard Biener <rguenther@suse.de>
c/
* Make-lang.in (cc1-checksum.c): For stage-final re-use
the checksum from the previous stage.
cp/
* Make-lang.in (cc1plus-checksum.c): For stage-final re-use
the checksum from the previous stage.
Index: gcc/c/Make-lang.in
===================================================================
*** gcc/c/Make-lang.in (revision 235623)
--- gcc/c/Make-lang.in (working copy)
*************** c_OBJS = $(C_OBJS) cc1-checksum.o c/gccs
*** 61,71 ****
c-warn = $(STRICT_WARN)
# compute checksum over all object files and the options
cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
$(C_OBJS) $(BACKEND) $(LIBDEPS)
! build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
checksum-options > cc1-checksum.c.tmp && \
! $(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c
cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
--- 61,78 ----
c-warn = $(STRICT_WARN)
# compute checksum over all object files and the options
+ # re-use the checksum from the prev-final stage so it passes
+ # the bootstrap comparison and allows comparing of the cc1 binary
cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
$(C_OBJS) $(BACKEND) $(LIBDEPS)
! if [ -f ../stage_final ] \
! && cmp -s ../stage_current ../stage_final; then \
! cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \
! else \
! build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
checksum-options > cc1-checksum.c.tmp && \
! $(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \
! fi
cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
Index: gcc/cp/Make-lang.in
===================================================================
*** gcc/cp/Make-lang.in (revision 235623)
--- gcc/cp/Make-lang.in (working copy)
*************** c++_OBJS = $(CXX_OBJS) cc1plus-checksum.
*** 90,100 ****
cp-warn = $(STRICT_WARN)
# compute checksum over all object files and the options
cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
$(CXX_OBJS) $(BACKEND) $(LIBDEPS)
! build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \
checksum-options > cc1plus-checksum.c.tmp && \
! $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c
cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
--- 90,107 ----
cp-warn = $(STRICT_WARN)
# compute checksum over all object files and the options
+ # re-use the checksum from the prev-final stage so it passes
+ # the bootstrap comparison and allows comparing of the cc1 binary
cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
$(CXX_OBJS) $(BACKEND) $(LIBDEPS)
! if [ -f ../stage_final ] \
! && cmp -s ../stage_current ../stage_final; then \
! cp ../prev-gcc/cc1plus-checksum.c cc1plus-checksum.c; \
! else \
! build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \
checksum-options > cc1plus-checksum.c.tmp && \
! $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \
! fi
cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \