This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


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

build speedup patch



This is a minor build cleanup which shaves about seven minutes off the
time for any make from top level.  The minimum time (nothing to do
anywhere) was ~15min on my system, now it's ~8min.  The basic idea is
to avoid o-iterator.mk whenever possible.

THERE ARE SEMANTIC CHANGES IN THIS PATCH.  The search order for source
files has been inverted.  It was build, common source, sysdep source;
now it's sysdep source, common source, build.  Also, no rules are
emitted to compile .S or .s files in the common source or build trees.
The patch also corrects all the things that this breaks for x86/Linux.
Other architectures of Linux shouldn't have problems.  Hurd and
standalone builds might have problems -- if you can, please test with
these.

Ulrich: The abi-note.S patch I sent you earlier today is also in this
patch.

zw

1998-09-20 17:37 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* Makerules: Emit rules to build from system-independent
          source and from the build tree with the rules to build from
          sysdeps (in sysd-rules).  Only emit rules for suffixes in
          $(object-suffixes-for-libc).  Don't bother generating dummy
          dependencies for .s files.
	  NOTE SEMANTIC CHANGES: Search order is now sysdeps, 
	  !sysdep source, build.  No rules are emitted to build from
          .s or .S files in !sysdep source or build.
	
	* csu/Makefile: Add an explicit rule to build abi-note.o from
          abi-note.S.
	* csu/abi-note.S: Clean up.  Don't include sysdep.h.
	* sysdeps/generic/lockfile.c: Moved...
	* stdio-common/lockfile.c: ...here.

	* Rules: Delete rules to create empty.o.  Delete rules to
          create dummy.os, dummy.op, etc.  Adjust $(generated)
          accordingly.

============================================================
Index: Makerules
--- Makerules	1998/09/16 17:40:48	1.313
+++ Makerules	1998/09/20 21:36:47
@@ -146,66 +146,25 @@
 # later directory would be chosen over a .c file in an earlier directory,
 # which does not preserve the desired sysdeps ordering behavior.
 
-# When making the list of .d files to include, we can't know which ones
-# have source in .s files, and thus do not in fact need a .d file.
-# So we must define rules to make .d files for .s files.
-define make-dummy-dep
-$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
-endef
-$(common-objpfx)dummy.d:
-	echo '# .s files cannot contain includes, so they need no deps.' > $@
-
-# It matters that this set of rules, for compiling from sources in
-# the current directory (the $srcdir/$subdir) come before the
-# generated sysdep rules in included from sysd-rules below.  When
-# compiling in the source tree, generated sources go into the current
-# directory, and those should be chosen before any sources in sysdeps.
-define o-iterator-doit
-$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
-
-define o-iterator-doit
-$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep)
-
-define o-iterator-doit
-$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
-
-# Omit the objpfx rules when building in the source tree, because
-# objpfx is empty and so these rules just override the ones above.
-ifdef objpfx
-# Define first rules to find the source files in $(objpfx).
-# Generated source files will end up there.
-define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
+# The order in which dirs are searched is now:
+# all sysdeps dirs
+# system-independent source dir
+# build dir.
+# This means you can't generate a source file with the same name as a
+# static source file anymore.  Preserving that is not worth the hair.
 
-define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep)
+# Don't include sysd-rules until sysd-Makefile is already there and has been
+# included.  It might define inhibit-sysdep-asm, which would affect the
+# contents of sysd-rules.
+ifdef sysd-Makefile-done
+-include $(+sysdir_pfx)sysd-rules
 
-define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
+ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
+# The value of $(+sysdep_dirs) the sysd-rules was computed for
+# differs from the one we are using now.  So force a rebuild of sysd-rules.
+sysd-rules-force = FORCE
+FORCE:
+endif
 endif
 
 # System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
@@ -218,44 +177,40 @@
 close-check-inhibit-asm = ;; esac ;
 endif
 
-# Don't include sysd-rules until sysd-Makefile is already there and has been
-# included.  It might define inhibit-sysdep-asm, which would affect the
-# contents of sysd-rules.
-ifdef sysd-Makefile-done
--include $(+sysdir_pfx)sysd-rules
-ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
-# The value of $(+sysdep_dirs) the sysd-rules was computed for
-# differs from the one we are using now.  So force a rebuild of sysd-rules.
-sysd-rules-force = FORCE
-FORCE:
-endif
-endif
-$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
-			  $(wildcard $(foreach dir,$(sysdirs),\
-					       $(dir)/Makefile))\
+$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules	\
+			  $(wildcard $(foreach dir,$(sysdirs),		\
+					       $(dir)/Makefile))	\
 			  $(sysd-rules-force)
 	-@rm -f $@T
-	(echo 'sysd-rules-sysdirs := $(config-sysdirs)';		      \
-	 for dir in $(config-sysdirs:%='$$(..)%'); do			      \
-	   for o in $(all-object-suffixes); do \
-	     $(open-check-inhibit-asm) \
-	     echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
-		  \$$(compile-command.S)";				      \
-	     echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
-		  \$$(compile-command.s)";				      \
-	     $(close-check-inhibit-asm)	\
-	     echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
-		  \$$(compile-command.c)";				      \
-	   done; \
-	   $(open-check-inhibit-asm) \
-	   echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
-		\$$(make-dummy-dep)";			       \
-	   echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
-		\$$(+make-deps)";					      \
-	   $(close-check-inhibit-asm)	\
-	   echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
-		\$$(+make-deps)";					      \
-	 done;								      \
+	(echo 'sysd-rules-sysdirs := $(config-sysdirs)';		\
+	 for dir in $(config-sysdirs:%='$$(..)%'); do			\
+	   for o in $(object-suffixes-for-libc); do			\
+	     echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile);	\
+		  \$$(compile-command.c)";				\
+	     $(open-check-inhibit-asm)					\
+	     echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile);	\
+		  \$$(compile-command.S)";				\
+	     echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile);	\
+		  \$$(compile-command.s)";				\
+	     $(close-check-inhibit-asm)					\
+	   done;							\
+	   echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile);		\
+		\$$(+make-deps)";					\
+	   $(open-check-inhibit-asm)					\
+	   echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile);		\
+		\$$(+make-deps)";					\
+	   $(close-check-inhibit-asm)					\
+	 done;								\
+	 for o in $(object-suffixes-for-libc); do			\
+	   echo "\$$(objpfx)%$$o: %.c \$$(before-compile);		\
+		  \$$(compile-command.c)";				\
+	   echo "\$$(objpfx)%$$o: \$$(objpfx)%.c \$$(before-compile);	\
+		  \$$(compile-command.c)";				\
+	 done;								\
+	 echo "\$$(objpfx)%.d: %.c \$$(before-compile);			\
+		\$$(+make-deps)";					\
+	 echo "\$$(objpfx)%.d: \$$(objpfx)%.c \$$(before-compile);	\
+		\$$(+make-deps)";					\
 	 echo 'sysd-rules-done = t') > $@T
 	mv -f $@T $@
 
============================================================
Index: Rules
--- Rules	1998/09/16 17:40:23	1.83
+++ Rules	1998/09/20 21:36:47
@@ -72,14 +72,13 @@
 $(AR) cr$(verbose) $@ $<
 endef
 
+$(common-objpfx)dummy.o: $(common-objpfx)dummy.c
+	$(compile-command.c)
 $(common-objpfx)dummy.c:
 	rm -f $@
 	echo 'void __dummy__ (void) { }' > $@
-$(common-objpfx)empty.c:
-	cp -f /dev/null $@
-common-generated += dummy.o dummy.c empty.c \
-		    $(addprefix empty,$(object-suffixes))
-
+common-generated += dummy.o dummy.c
+
 # This makes all the auxiliary and test programs.
 
 .PHONY: others tests
@@ -186,20 +185,6 @@
 # headers are in place before building a subdirectory.
 .PHONY: before-compile
 before-compile: $(before-compile)
-
-define o-iterator-doit
-$(common-objpfx)empty$o: $(common-objpfx)empty.c $(before-compile);
-	$$(compile-command.c)
-endef
-object-suffixes-left := $(object-suffixes)
-include $(o-iterator)
-
-define o-iterator-doit
-$(common-objpfx)dummy$o: $(common-objpfx)dummy.c $(before-compile);
-	$$(compile-command.c)
-endef
-object-suffixes-left := $(object-suffixes)
-include $(o-iterator)
 
 # There's no good place to put this - here will do.
 # The dependencies are wrong if it's run from the top level.
============================================================
Index: csu/Makefile
--- csu/Makefile	1998/07/04 14:34:55	1.35
+++ csu/Makefile	1998/09/20 21:36:47
@@ -46,7 +46,6 @@
 include ../Makeconfig
 
 ifeq (yes,$(elf))
-before-compile += $(objpfx)abi-tag.h
 generated += abi-tag.h
 endif
 
@@ -83,6 +82,10 @@
 $(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
 
+# and abi-note.o (built from .S file in arch-indep dir, special case).
+$(objpfx)abi-note.o: abi-note.S $(objpfx)abi-tag.h
+	$(compile.S) -g0 -o $@
+
 CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions
 
 $(objpfx)initfini.s: initfini.c
@@ -108,7 +111,7 @@
 endif
 
 ifeq (yes,$(elf))
-extra-objs += abi-note.o init.o
+extra-objs += init.o
 asm-CPPFLAGS += -I$(objpfx).
 endif
 
============================================================
Index: stdio-common/lockfile.c
--- stdio-common/lockfile.c	Wed Dec 31 19:00:00 1969
+++ stdio-common/lockfile.c	Sun Oct 12 23:52:23 1997	1.1
@@ -0,0 +1,60 @@
+/* lockfile - Handle locking and unlocking of stream.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+typedef int FILE;
+
+
+void
+__internal_flockfile (FILE *stream)
+{
+  /* Do nothing.  Using this version does not do any locking.  */
+}
+#ifdef USE_IN_LIBIO
+weak_alias (__internal_flockfile, _IO_flockfile)
+#else
+weak_alias (__internal_flockfile, __flockfile)
+#endif
+weak_alias (__internal_flockfile, flockfile);
+
+
+void
+__internal_funlockfile (FILE *stream)
+{
+  /* Do nothing.  Using this version does not do any locking.  */
+}
+#ifdef USE_IN_LIBIO
+weak_alias (__internal_funlockfile, _IO_funlockfile)
+#else
+weak_alias (__internal_funlockfile, __funlockfile)
+#endif
+weak_alias (__internal_funlockfile, funlockfile);
+
+
+int
+__internal_ftrylockfile (FILE *stream)
+{
+  /* Do nothing.  Using this version does not do any locking.  */
+  return 1;
+}
+#ifdef USE_IN_LIBIO
+weak_alias (__internal_ftrylockfile, _IO_ftrylockfile)
+#else
+weak_alias (__internal_ftrylockfile, __ftrylockfile)
+#endif
+weak_alias (__internal_ftrylockfile, ftrylockfile);
============================================================
Index: sysdeps/generic/lockfile.c
--- sysdeps/generic/lockfile.c	Sun Sep 20 17:32:10 1998	1.1
+++ sysdeps/generic/lockfile.c	Wed Dec 31 19:00:00 1969
@@ -1,60 +0,0 @@
-/* lockfile - Handle locking and unlocking of stream.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-typedef int FILE;
-
-
-void
-__internal_flockfile (FILE *stream)
-{
-  /* Do nothing.  Using this version does not do any locking.  */
-}
-#ifdef USE_IN_LIBIO
-weak_alias (__internal_flockfile, _IO_flockfile)
-#else
-weak_alias (__internal_flockfile, __flockfile)
-#endif
-weak_alias (__internal_flockfile, flockfile);
-
-
-void
-__internal_funlockfile (FILE *stream)
-{
-  /* Do nothing.  Using this version does not do any locking.  */
-}
-#ifdef USE_IN_LIBIO
-weak_alias (__internal_funlockfile, _IO_funlockfile)
-#else
-weak_alias (__internal_funlockfile, __funlockfile)
-#endif
-weak_alias (__internal_funlockfile, funlockfile);
-
-
-int
-__internal_ftrylockfile (FILE *stream)
-{
-  /* Do nothing.  Using this version does not do any locking.  */
-  return 1;
-}
-#ifdef USE_IN_LIBIO
-weak_alias (__internal_ftrylockfile, _IO_ftrylockfile)
-#else
-weak_alias (__internal_ftrylockfile, __ftrylockfile)
-#endif
-weak_alias (__internal_ftrylockfile, ftrylockfile);
============================================================
Index: csu/abi-note.S
--- csu/abi-note.S	1997/05/07 15:09:37	1.2
+++ csu/abi-note.S	1998/09/20 22:00:56
@@ -26,26 +26,6 @@
    write to the Free Software Foundation, 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sysdep.h>
-
-/* The basic layout of note sections is specified by the ELF format.  */
-
-#define ELF_NOTE_BEGIN(sectname, sectflags, type, name)			      \
-	.section sectname, sectflags;					      \
-	.align 4;		/* Notes are 4-byte aligned.  */	      \
-	.long 1f - 0f;		/* 32-bit word: length of name field */	      \
-	.long 3f - 2f;		/* 32-bit word: length of desc field */	      \
-	.long (type);		/* 32-bit word: vendor-defined type field */  \
-0:	.asciz name;		/* null-terminated string, any length: name */\
-1:	.align 4;		/* Name data padded to 4-byte alignment.  */  \
-2:	/* Here follows the "note descriptor" data, whose format	      \
-	   is not specified by ELF.  The vendor name and type field	      \
-	   indicate what sort of data is found here.  */
-
-#define ELF_NOTE_END							      \
-3:	.align 4		/* Pad to 4-byte align the next note.  */
-
-
 /* The linker (GNU ld 2.8 and later) recognize an allocated section whose
    name begins with `.note' and creates a PT_NOTE program header entry
    pointing at it.
@@ -64,6 +44,12 @@
 
 #include <abi-tag.h>		/* OS-specific ABI tag value */
 
-ELF_NOTE_BEGIN(".note.ABI-tag", "a", 1, "GNU")
-	.long ABI_TAG
-ELF_NOTE_END
+	.section ".note.ABI-tag", "a"
+	.align 4		/* Notes are 4-byte aligned.  */
+	.long 1f - 0f		/* 32-bit word: length of name field */
+	.long 3f - 2f		/* 32-bit word: length of desc field */
+	.long  1		/* 32-bit word: vendor-defined type field */
+0:	.asciz "GNU"		/* null-terminated string, any length: name */
+1:	.align 4		/* Pad name to 4-byte alignment.  */
+2:	.long ABI_TAG		/* Note data: the ABI tag. */
+3:	.align 4		/* Pad to 4-byte align the next note. */


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