Testing the libz size fix in ofwboot.net showed that rebuilding ofwboot
after updating libz sources did not relink ofwboot as it should, imho:
$ cd sys/arch/sparc64/stand
$ make
...
$ touch ../../../lib/libz/crc32.c
$ make
===> bootblk
===> libsa
===> libz
cc -O2 -pipe -g -fno-stack-protector -msoft-float -ffreestanding -MD
-MP -D_LP64 -g -Wa,-Av9a -I/usr/src/sys/arch/sparc64/stand/libz/../../../..
-fno-pie -DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -I. -D_STANDALONE -DSUN4U -I.
-DDYNAMIC_CRC_TABLE -DBUILDFIXED -c
/usr/src/sys/arch/sparc64/stand/libz/../../../../lib/libz/crc32.c -o crc32.o
building standard z library
ranlib libz.a
===> ofwboot
===> ofwboot.net
===> ofwbootfd
ofwboot/Makefile defines LIBSA and LIBZ as prerequisite for PROG, but the
two former variables are not defined until which includes
"../Makefile.inc" which defines them.
It still works because a) libsa and libz are always built before ofwboot,
thus the intended but effectively missing dependency is always there, and
b) make(1) variables inside commands are evaluated lazily at run-time,
while those in targets and prerequisites are evaluated at parse-time:
$ make -C ofwboot -p | grep -C1 ^ofwboot
ofwboot : /usr/lib/crt0.o srt0.o Locore.o alloc.o boot.o
elf64_exec.o arc4.o net.o netif_of.o ofdev.o vers.o diskprobe.o
softraid_sparc64.o strlcpy.o strcmp.o strlcat.o strlen.o ffs.o aes_xts.o
bcrypt_pbkdf.o blowfish.o explicit_bzero.o hmac_sha1.o pkcs5_pbkdf2.o
rijndael.o sha1.o sha2.o softraid.o /usr/lib/libc.a /usr/lib/crtbegin.o
/usr/lib/crtend.o
${LD} -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} -nopie
-znorelro ${OBJS} -L${LIBSADIR} ${LIBSA} -L${LIBZDIR} ${LIBZ}
Diff below fixes this, but I doubt this is the way to go:
# make -C ofwboot -p | grep -C1 ^ofwboot
# parent targets: all
ofwboot :
/usr/src/sys/arch/sparc64/stand/ofwboot/../libsa//libsa.a
/usr/src/sys/arch/sparc64/stand/ofwboot/../libz//libz.a /usr/lib/crt0.o srt0.o
Locore.o alloc.o boot.o elf64_exec.o arc4.o net.o netif_of.o ofdev.o vers.o
diskprobe.o softraid_sparc64.o strlcpy.o strcmp.o strlcat.o strlen.o ffs.o
aes_xts.o bcrypt_pbkdf.o blowfish.o explicit_bzero.o hmac_sha1.o pkcs5_pbkdf2.o
rijndael.o sha1.o sha2.o softraid.o /usr/lib/libc.a /usr/lib/crtbegin.o
/usr/lib/crtend.o
${LD} -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} -nopie
-znorelro ${OBJS} -L${LIBSADIR} ${LIBSA} -L${LIBZDIR} ${LIBZ}
# touch ../../../lib/libz/crc32.c
# make
===> bootblk
===> libsa
===> libz
cc -O2 -pipe -g -fno-stack-protector -msoft-float -ffreestanding -MD
-MP -D_LP64 -g -Wa,-Av9a -I/usr/src/sys/arch/sparc64/stand/libz/../../../..
-fno-pie -DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -I. -D_STANDALONE -DSUN4U -I.
-DDYNAMIC_CRC_TABLE -DBUILDFIXED -c
/usr/src/sys/arch/sparc64/stand/libz/../../../../lib/libz/crc32.c -o crc32.o
building standard z library
ranlib libz.a
===> ofwboot
Warning: target
/usr/src/sys/arch/sparc64/stand/ofwboot/../libsa//libsa.a (prerequisite of:
ofwboot) does not have any command (BUG)
Warning: target /usr/src/sys/arch/sparc64/stand/ofwboot/../libz//libz.a
(prerequisite of: ofwboot) does not have any command (BUG)
ld -N -Ttext 10 -e _start -o ofwboot -nopie -znorelro srt0.o
Locore.o alloc.o boot.o elf64_exec.o arc4.o net.o netif_of.o ofdev.o vers.o
diskprobe.o softraid_sparc64.o strlcpy.o strcmp.o strlcat.o strlen.o ffs.o
aes_xts.o bcrypt_pbkdf.o blowfish.o explicit_bzero.o hmac_sha1.o pkcs5_pbkdf2.o
rijndael.o sha1.o sha2.o softraid.o
-L/usr/src/sys/arch/sparc64/stand/ofwboot/../libsa
/usr/src/sys/arch/sparc64/stand/ofwboot/../libsa/obj/libsa.a
-L/usr/src/sys/arch/sparc64/stand/ofwboot/../libz
/usr/src/sys/arch/sparc64/stand/ofwboot/../libz/obj/libz.a
===> ofwboot.net
Warning: target
/usr/src/sys/arch/sparc64/stand/ofwboot.net/../libsa//libsa.a (prerequisite of:
ofwboot.net) does not have any command (BUG)
Warning: target
/usr/src/sys/arch/sparc64/stand/ofwboot.net/../libz//libz.a (prerequisite of:
ofwboot.net) does not have any command (BUG)
ld -N -Ttext 10 -e _start -o ofwboot.net -nopie -znorelro srt0.o
Locore.o alloc.o boot.o elf64_exec.o arc4.o net.o netif_of.o ofdev.o vers.o
strlcpy.o strcmp.o strlcat.o strlen.o ffs.o
-L/usr/src/sys/arch/sparc64/stand/ofwboot.net/../libsa
/usr/src/sys/arch/sparc64/stand/ofwboot.net/../libsa/obj/libsa.a
-L/usr/src/sys/arch/sparc64/stand/ofwboot.net/../libz
/usr/src/sys/arch/sparc64/stand/ofwboot.net/../libz/obj/libz.a
===> ofwbootfd
Warning: target
/usr/src/sys/arch/sparc64/stand/ofwbootfd/../libsa//libsa.a (prerequisite of:
ofwbootfd) does not have any command (BUG)
Warning: target
/usr/src/sys/arch/sparc64/stand/ofwbootfd/../lib