This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Top-level profiledbootstrap bugfixes


When adding support for profiled toplevel bootstrap, I had the wrong
impression that the training is done while building the runtime
libraries, and I coded the toplevel bootstrap support accordingly.
Instead, it is done only on building GCC itself!

I don't know the exact reason for this in the "old-style" bootstrap
rules.  In the case of toplevel bootstrap, however, training on
the host and target modules is breaking Java profiledbootstraps:
stageprofile-fastjar is compiled without -fprofile-generate and tries to
link to a profile-enabled zlib.  It is already an improvement
to train the compiler on libcpp and libiberty (on a combined tree,
gas/ld/binutils too), anyway.

This simplifies the rules that support profiledbootstrap, because
the same machinery that orders stage1/2/3 can be used to order
stagefeedback after stageprofile.

I tested this on a combined tree on i686-pc-linux-gnu.  I had to use
--disable-werror (because of aliasing warnings in bfd and ld), and
ld crashed while building libstdc++.  But other target modules,
such as mudflap and libobjc, compiled ok, and the testsuite results
for C are otherwise fine.

Ok for gcc and src?

Paolo

ps: I am going on vacation next Friday, if the approval comes later feel free to commit it for me!
2006-06-22  Paolo Bonzini  <bonzini@gnu.org>

	* Makefile.def (stagefeedback): Come after profile.
	Define profiledbootstrap target.
	* Makefile.tpl (profiledbootstrap): Remove.
	(stageprofile-end): Zap stagefeedback.
	(stagefeedback-start): Copy all .gcda files, not only GCC's.

Index: Makefile.def
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.def,v
retrieving revision 1.51
diff -u -p -r1.51 Makefile.def
*** Makefile.def	20 May 2005 07:10:30 -0000	1.51
--- Makefile.def	22 Jun 2005 09:28:10 -0000
***************
*** 473,478 ****
  	stage_configure_flags="@stage2_werror_flag@" ;
  	stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"' ; };
  bootstrap_stage = {
! 	id=feedback ; prev=1 ;
  	stage_configure_flags="@stage2_werror_flag@" ;
  	stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-use"' ; };
--- 473,479 ----
  	stage_configure_flags="@stage2_werror_flag@" ;
  	stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"' ; };
  bootstrap_stage = {
! 	id=feedback ; prev=profile ;
! 	bootstrap_target=profiledbootstrap ;
  	stage_configure_flags="@stage2_werror_flag@" ;
  	stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-use"' ; };
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.132
diff -c -r1.132 Makefile.tpl
*** Makefile.tpl	25 May 2005 14:18:53 -0000	1.132
--- Makefile.tpl	22 Jun 2005 09:48:12 -0000
***************
*** 1445,1476 ****
  
  [+ ENDFOR bootstrap-stage +]
  
! stagefeedback-start::
! 	@r=`${PWD_COMMAND}`; export r; \
! 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
! 	cd stageprofile-gcc && \
! 	  { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../gcc/&",' | $(SHELL); } && \
! 	  { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../gcc/&",' | $(SHELL); }
  
! # FIXME: Will not need to be conditional when toplevel bootstrap is the
! # only possibility, but now it conflicts with no-bootstrap rules
! @if gcc-bootstrap
! profiledbootstrap:
! 	@r=`${PWD_COMMAND}`; export r; \
! 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
! 	$(HOST_EXPORTS) \
! 	echo "Bootstrapping the compiler"; \
! 	$(MAKE) stageprofile-bubble distclean-stagefeedback
! 	@r=`${PWD_COMMAND}`; export r; \
! 	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
! 	echo "Building runtime libraries and training compiler"; \
! 	$(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
  	@r=`${PWD_COMMAND}`; export r; \
  	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
! 	$(HOST_EXPORTS) \
! 	echo "Building feedback based compiler"; \
! 	$(MAKE) stagefeedback-bubble stagefeedback-end
! @endif gcc-bootstrap
  
  @if gcc-bootstrap
  NOTPARALLEL = .NOTPARALLEL
--- 1445,1462 ----
  
  [+ ENDFOR bootstrap-stage +]
  
! stageprofile-end::
! 	$(MAKE) distclean-stagefeedback
  
! stagefeedback-start::
  	@r=`${PWD_COMMAND}`; export r; \
  	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
! 	for i in prev-*; do \
! 	  j=`echo $$i | sed s/^prev-//` ; \
! 	  cd $$r/$$i && \
! 	  { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
! 	  { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
! 	done
  
  @if gcc-bootstrap
  NOTPARALLEL = .NOTPARALLEL

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]