A new static binary patch

Geoff Keating geoffk@ozemail.com.au
Fri Aug 27 19:50:00 GMT 1999


> Date: Fri, 27 Aug 1999 19:17:32 -0700 (PDT)
> Cc: libc-hacker@sourceware.cygnus.com
> From: hjl@lucon.org (H.J. Lu)

> > Just create a _new_ rule, which _only_ knows how to run static
> > programs.  Don't try to make the existing rule, which is for running
> > non-static programs, do both jobs.
> 
> I couldn't find a better way.

Try the following.  It needs a ChangeLog entry.  It took me 6 minutes,
and I haven't tested it.  I think it automatically builds the
executables, you might want to change that.  The only slightly ugly
thing about it is that you get '.sout' files, the better thing to do
would be to write 

$(tests-static:%=$(objpfx)%.out) : $(objpfx)%.out: %.args $(objpfx)% %.input

in the rules, and a similar thing for the non-static rules.

-- 
Geoffrey Keating <geoffk@cygnus.com>

===File ~/z=================================================
--- BUILD/glibc-2.1.2pre3/Rules~	Mon Jan 18 20:26:53 1999
+++ BUILD/glibc-2.1.2pre3/Rules	Sat Aug 28 12:46:54 1999
@@ -86,17 +86,17 @@
 others: $(addprefix $(objpfx),$(extra-objs))
 endif
 ifeq ($(cross-compiling),yes)
-tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
+tests: $(addprefix $(objpfx),$(tests) $(test-srcs) $(tests-static))
 else
-tests: $(tests:%=$(objpfx)%.out)
+tests: $(tests:%=$(objpfx)%.out) $(tests-static:%=$(objpfx)%.sout)
 endif
 
 ifeq ($(build-programs),yes)
 binaries-all = $(others) $(sysdep-others) $(tests) $(test-srcs)
-binaries-static = $(others-static)
+binaries-static = $(others-static) $(tests-static)
 else
 binaries-all = $(tests) $(test-srcs)
-binaries-static =
+binaries-static = $(tests-static)
 endif
 
 binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
@@ -127,6 +127,16 @@
 $(objpfx)%.out: /dev/null $(objpfx)%	# Make it 2nd arg for canned sequence.
 	$($*-ENV) $(built-program-cmd) > $@
 endif	# tests
+ifneq "$(strip $(tests-static))" ""
+$(objpfx)%.sout: %.args $(objpfx)% %.input
+	$($*-ENV) $(built-program-file) `cat $(word 1,$^)` < $(word 3,$^) > $@
+$(objpfx)%.sout: %.args $(objpfx)%
+	$($*-ENV) $(built-program-file) `cat $(word 1,$^)` > $@
+$(objpfx)%.sout: %.input $(objpfx)%
+	$($*-ENV) $(built-program-file) < $(word 1,$^) > $@
+$(objpfx)%.sout: /dev/null $(objpfx)%	# Make it 2nd arg for canned sequence.
+	$($*-ENV) $(built-program-file) > $@
+endif	# tests-static
 
 .PHONY: distclean realclean subdir_distclean subdir_realclean \
 	subdir_clean subdir_mostlyclean subdir_testclean
============================================================


More information about the Libc-hacker mailing list