[klibc] Non-kbuild klibc obsoleted

Sam Ravnborg sam at ravnborg.org
Tue Dec 13 13:22:04 PST 2005


On Tue, Dec 13, 2005 at 09:48:44AM -0800, H. Peter Anvin wrote:
> Hi there,
> 
> Just found a problem... the old Makefile produced e.g. 
> utils/{static,shared,static.g,shared.g} with and without debugging 
> turned on.  This is important, since with klibc sometimes these aren't 
> just the same thing as building with debugging and then stripping; that 
> doesn't work too well on e.g. x86-64.
> 
> Any idea how to get this back?

I took the simple approch and always do it when building
the shared / static binaries.
I assume this cover your need.

Please note one major drawback. If you delete the *.g file kbuild
will NOT notice and will not rebuild it.

	Sam

kbuild: create stripped versions of programs

When building utilities always create a file.g that is the non-stripped
binary. Please note that the file.g file is created as a side effect,
so kbuild does not know about it. In other words kbuild will not rebuild
the .g file if you delete it. And it will overwrite it no matter the
timestamp on the file

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>

diff --git a/dash/Kbuild b/dash/Kbuild
index 25c6318..ff07cec 100644
--- a/dash/Kbuild
+++ b/dash/Kbuild
@@ -57,7 +57,7 @@ sh.shared-y := $(sh-y)
 hostprogs-y := $(HELPERS)
 
 # For cleaning
-targets := $(static-y) $(shared-y) $(CLEANFILES)
+targets := sh sh.g sh.shared sh.shared.g $(CLEANFILES)
 
 # Generate token.h
 $(obj)/parser.o: $(obj)/token.h
diff --git a/gzip/Kbuild b/gzip/Kbuild
index c92eeea..214ce61 100644
--- a/gzip/Kbuild
+++ b/gzip/Kbuild
@@ -7,7 +7,7 @@ static-y := gzip
 gzip-y   := gzip.o util.o unzip.o inflate.o
 
 # Additional targets 
-always := gunzip zcat gzip.stripped
+always := gunzip zcat
 
 # Optional ZIP support
 gzip-$(CONFIG_KLIB_ZIP)   += zip.o deflate.o trees.o bits.o
@@ -18,12 +18,8 @@ EXTRA_KLIBCCFLAGS := $(cflags-y)
 $(obj)/gunzip $(obj)/zcat: $(obj)/gzip
 	$(call cmd,ln)
 
-# A stripped version of gzip
-$(obj)/gzip.stripped: $(obj)/gzip
-	$(call cmd,strip)
-
 # Cleaning
-targets := $(static-y) $(shared-y)
+targets := gzip gzip.g gunzip zcat
 
 # Targets to install
 install-y := gzip gunzip zcat
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 8de9aa5..e54e790 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -245,7 +245,10 @@ quiet_cmd_ld-static = KLIBCLD $@
                        $(EXTRA_KLIBCLDFLAGS)              \
                        $(KLIBCCRT0)                       \
                        $(link-deps)                       \
-                       $(KLIBCLIBC) $(KLIBCLIBGCC)
+                       $(KLIBCLIBC) $(KLIBCLIBGCC);       \
+                       cp -f $@ $@.g;                     \
+                       $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@
+		       
 
 $(static-y): $(klibc-objs) $(lib-target) FORCE
 	$(call if_changed,ld-static)
@@ -255,7 +258,10 @@ quiet_cmd_ld-shared = KLIBCLD $@
                        $(EXTRA_KLIBCLDFLAGS)              \
                        $(KLIBCEMAIN) $(KLIBCCRTSHARED)    \
                        $(link-deps)                       \
-                       -R $(KLIBCLIBCSHARED) $(KLIBCLIBGCC)
+                       -R $(KLIBCLIBCSHARED) $(KLIBCLIBGCC);\
+                       cp -f $@ $@.g;                     \
+                       $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@
+ 
 		       
 $(shared-y): $(klibc-objs) $(lib-target) FORCE
 	$(call if_changed,ld-shared)
diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild
index a2d899e..0735da6 100644
--- a/usr/kinit/Kbuild
+++ b/usr/kinit/Kbuild
@@ -19,7 +19,7 @@ KLIBCCFLAGS_nfsroot.o := -I$(srctree)/$(
 # TODO - stripped image
 
 # Cleaning
-targets := $(static-y) $(shared-y)
+targets := kinit kinit.g
 subdir- := ipconfig nfsmount
 
 



More information about the klibc mailing list