[klibc] [klibc:master] Kbuild: Always build static library reproducibly

klibc-bot for Ben Hutchings ben at decadent.org.uk
Tue Apr 27 18:12:14 PDT 2021


Commit-ID:  7c6e6ba78fec5bc4549c627edd3a118bdebab139
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=7c6e6ba78fec5bc4549c627edd3a118bdebab139
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Wed, 28 Apr 2021 01:47:07 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Wed, 28 Apr 2021 01:57:08 +0200

[klibc] Kbuild: Always build static library reproducibly

The "ar D" and "ranlib -D" options have been supported for a long
time, and the kernel itself now uses "ar D" unconditionally.  Remove
the KBUILD_REPRODUCIBLE variable and always use these options.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 scripts/Kbuild.klibc   | 10 +++-------
 usr/klibc/Kbuild       |  2 +-
 usr/klibc/README.klibc |  7 -------
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index a4be6cb4..45b4e84a 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -102,11 +102,7 @@ KLIBCLD          := $(LD)
 KLIBCCC          := $(CC)
 KLIBCAR          := $(AR)
 
-# klibc-ar is a macro that invokes KLIBCAR and takes 2 arguments of ar commands.
-# The second will be used for reproducible builds, the first otherwise.
-klibc-ar = $(KLIBCAR) $(if $(KBUILD_REPRODUCIBLE),$(2),$(1))
-
-KLIBCRANLIB      := $(RANLIB) $(if $(KBUILD_REPRODUCIBLE),-D)
+KLIBCRANLIB      := $(RANLIB) -D
 KLIBCSTRIP       := $(if $(CONFIG_DEBUG_INFO),true,$(STRIP))
 KLIBCNM          := $(NM)
 KLIBCOBJCOPY     := $(OBJCOPY)
@@ -286,8 +282,8 @@ ifdef lib-target
 quiet_cmd_link_o_target = LD      $@
 # If the list of objects to link is empty, just create an empty lib.a
 cmd_link_o_target = $(if $(strip $(lib-y)),\
-                    rm -f $@; $(call klibc-ar,cru,Dcr) $@ $(filter $(lib-y), $^),\
-                    rm -f $@; $(call klibc-ar,crs,Dcrs) $@)
+                    rm -f $@; $(KLIBCAR) Dcr $@ $(filter $(lib-y), $^),\
+                    rm -f $@; $(KLIBCAR) Dcrs $@)
 
 $(lib-target): $(lib-y) FORCE
 	$(call if_changed,link_o_target)
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index dea94d06..9ea55a23 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -132,7 +132,7 @@ klib-o-files = $(shell cat $(obj)/klib.list \
 targets += libc.a __static_init.o
 quiet_cmd_libc = KLIBCAR $@
       cmd_libc = rm -f $@;						\
-                 $(call klibc-ar,cq,Dcq) $@				\
+                 $(KLIBCAR) Dcq $@					\
 		 $(call objectify,__static_init.o) $(klib-o-files);	\
                  $(KLIBCRANLIB) $@
 
diff --git a/usr/klibc/README.klibc b/usr/klibc/README.klibc
index 6ccc8395..f562661f 100644
--- a/usr/klibc/README.klibc
+++ b/usr/klibc/README.klibc
@@ -92,13 +92,6 @@ don't need the kernel source as well.  You can either:
 2. Set the KLIBCKERNELSRC variable on the "make" command line to
    point to the *parent* of the UAPI headers directory.
 
-Reproducible builds
--------------------
-
-Static libraries usually contain file timestamps, which are not
-reproducible.  Set KBUILD_REPRODUCIBLE=1 on the "make" command line to
-disable this.
-
 Architecture support
 ====================
 


More information about the klibc mailing list