[2/2] Sort objects in gdb and gdbserver Makefiles

Message ID 20180916125141.6672-2-simon.marchi@polymtl.ca
State New, archived
Headers

Commit Message

Simon Marchi Sept. 16, 2018, 12:51 p.m. UTC
  Tom mentioned this a while ago, as a way to give you a cheap sense of
progression in your build, as all object files will be built
alphabetically (including the directory part).  I tried it and I think
it's nice.

gdb/ChangeLog:

	* Makefile.in (LIBGDB_OBS): Sort COMMON_OBS.

gdb/gdbserver/ChangeLog:

	* Makefile.in (gdbserver$(EXEEXT)): Sort OBS.
	(gdbreplay$(EXEEXT)): Sort GDBREPLAY_OBS.
	($(IPA_LIB)): Sort IPA_OBJS.
---
 gdb/Makefile.in           | 2 +-
 gdb/gdbserver/Makefile.in | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Tom Tromey Sept. 16, 2018, 2:12 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> Tom mentioned this a while ago, as a way to give you a cheap sense of
Simon> progression in your build, as all object files will be built
Simon> alphabetically (including the directory part).  I tried it and I think
Simon> it's nice.

Simon> gdb/ChangeLog:

Simon> 	* Makefile.in (LIBGDB_OBS): Sort COMMON_OBS.

Simon> gdb/gdbserver/ChangeLog:

Simon> 	* Makefile.in (gdbserver$(EXEEXT)): Sort OBS.
Simon> 	(gdbreplay$(EXEEXT)): Sort GDBREPLAY_OBS.
Simon> 	($(IPA_LIB)): Sort IPA_OBJS.

I think it is a nice idea.

The only counter-case I could think of would be if gdb had some object
whose build time was notably slower than everything else.  In that case
you'd want to start it earlier for better parallelization.

However I don't think that's the case, or at least I haven't noticed;
and anyway it isn't like we've micro-optimized the build that way
anyhow.

Tom
  

Patch

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d49f3eef446e..87eb825aa991 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1888,7 +1888,7 @@  stamp-init: $(INIT_FILES)
 # against that.
 #
 # init.o is very important.  It pulls in the rest of GDB.
-LIBGDB_OBS = $(COMMON_OBS) init.o
+LIBGDB_OBS = $(sort $(COMMON_OBS)) init.o
 libgdb.a: $(LIBGDB_OBS)
 	-rm -f libgdb.a
 	$(AR) q libgdb.a $(LIBGDB_OBS)
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index c07f84d51209..dfefff915545 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -395,7 +395,7 @@  install-html:
 clean-info: force
 	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
 
-gdbserver$(EXEEXT): $(OBS) ${CDEPS} $(LIBGNU) $(LIBIBERTY)
+gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY)
 	$(SILENCE) rm -f gdbserver$(EXEEXT)
 	$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
 		-o gdbserver$(EXEEXT) $(OBS) $(LIBGNU) $(LIBIBERTY) \
@@ -406,7 +406,7 @@  all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile
 	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS="$(SUBDIRS)" subdir_do
 .PHONY: all-lib
 
-gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY)
+gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY)
 	$(SILENCE) rm -f gdbreplay$(EXEEXT)
 	$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
 		-o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) $(LIBGNU) \
@@ -430,7 +430,7 @@  IPA_OBJS = \
 
 IPA_LIB = libinproctrace.so
 
-$(IPA_LIB): $(IPA_OBJS) ${CDEPS}
+$(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
 	$(SILENCE) rm -f $(IPA_LIB)
 	$(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
 		-Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \