]> git.ipfire.org Git - thirdparty/coreutils.git/commit
build: reduce size of multi-call binary by reusing cksum logic
authorPádraig Brady <P@draigBrady.com>
Sat, 6 Dec 2025 13:47:11 +0000 (13:47 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 13 Dec 2025 17:18:47 +0000 (17:18 +0000)
commitcd52292221adaff8cf67299106d78007b8fa8616
treeea2770a99d84051d1005210d8e07157275de33de
parentcdb966adb30e2744f7584fafad13f80341ac8f4a
build: reduce size of multi-call binary by reusing cksum logic

Map md5sum and sha{1,224,256,385,512} to use cksum logic,
which selects appropriate behavior at runtime, rather than
separate binaries for each closely related utility.

$ size src/coreutils  # before
   text    data     bss     dec     hex filename
1349509    6812  619312 1975633  1e2551 src/coreutils
$ size src/coreutils  # after
   text    data     bss     dec     hex filename
1306933    6748  619152 1932833  1d7e21 src/coreutils

* build-aux/gen-single-binary.sh: Map sha*sum to use cksum.c
* src/cksum.c: Adjust to behave more like sha*sum,
when the algorithm to something other than "crc".
* src/cksum.h: Expose the cksum_algorithm global and enum.
* src/coreutils-md5sum.c: Set cksum_algorithm and call cksum logic.
* src/coreutils-sha1sum.c: Likewise.
* src/coreutils-sha224sum.c Likewise.
* src/coreutils-sha256sum.c Likewise.
* src/coreutils-sha384sum.c Likewise.
* src/coreutils-sha512sum.c Likewise.
* NEWS: Mention the improvement.
NEWS
build-aux/gen-single-binary.sh
src/cksum.c
src/cksum.h [new file with mode: 0644]
src/coreutils-md5sum.c [new file with mode: 0644]
src/coreutils-sha1sum.c [new file with mode: 0644]
src/coreutils-sha224sum.c [new file with mode: 0644]
src/coreutils-sha256sum.c [new file with mode: 0644]
src/coreutils-sha384sum.c [new file with mode: 0644]
src/coreutils-sha512sum.c [new file with mode: 0644]
src/local.mk