From: Miod Vallat Subject: Re: timing lld --threads for fun and profit To: Klemens Nanni Cc: Landry Breuil , robert@openbsd.org, tech@openbsd.org Date: Tue, 12 Nov 2024 13:22:40 +0000 > Can someone explain to me why this work when done in > /usr/share/relink/kernel/GENERIC.MP/Makefile > but fails when done in > > Index: sys/arch/amd64/conf/Makefile.amd64 > =================================================================== > RCS file: /cvs/src/sys/arch/amd64/conf/Makefile.amd64,v > diff -u -p -r1.137 Makefile.amd64 > --- sys/arch/amd64/conf/Makefile.amd64 7 Jun 2024 05:17:34 -0000 1.137 > +++ sys/arch/amd64/conf/Makefile.amd64 12 Nov 2024 12:49:03 -0000 > @@ -86,6 +86,7 @@ COPTIMIZE?= -O2 > CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTIMIZE} ${COPTS} ${PIPE} > AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS} > LINKFLAGS= -T ld.script -X --warn-common -nopie > +LINKFLAGS+= -Wl,--threads=5 > > HOSTCC?= ${CC} > HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} > > > $ cd /usr/src/sys/arch/amd64/compile/GENERIC.MP > $ make config ; make > config -b /sys/arch/amd64/compile/GENERIC.MP/obj -s /sys /sys/arch/amd64/conf/GENERIC.MP > $ make > [...] > LD="ld" sh makegap.sh 0xcccccccc gapdummy.o > ld -T ld.script -X --warn-common -nopie -Wl,--threads=5 -o bsd ${SYSTEM_HEAD} vers.o ${OBJS} > ld: error: unknown argument '-Wl,--threads=5' > *** Error 1 in /sys/arch/amd64/compile/GENERIC.MP (Makefile:2225 'bsd': @echo ld -T ld.script -X --warn-common -nopie -Wl,--threads=5 -o bsd...) Because -Wl,... is a compiler option, and here LINKFLAGS are passed to ld, so this should be simply --threads=5, without the "-Wl," prefix.