1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-16 10:14:35 +00:00

rework the way we reconsturct the object file order for syspatches

this change drops the exclude regex and just simply checks if the
object files are actually available and then constucts a response
file which we pass for linking and this seems to be good enough
to have reproducible make build output (which is what we want here)

ok tb@
This commit is contained in:
robert
2026-03-17 17:07:58 +00:00
parent 561bf2d229
commit 5631923097

View File

@@ -1,4 +1,4 @@
# $OpenBSD: bsd.lib.mk,v 1.105 2025/11/16 10:20:54 robert Exp $
# $OpenBSD: bsd.lib.mk,v 1.106 2026/03/17 17:07:58 robert Exp $
# $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft Exp $
# @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
@@ -206,22 +206,19 @@ lib${LIB}_p.a: ${POBJS}
SOBJS+= ${OBJS:.o=.so}
BUILDAFTER += ${SOBJS}
# exclude from readelf(1) output for syspatch building
EXCLUDE_REGEX:= "(cmll-586|(comparetf|libgcc|unwind-dw)2| \
mul(t|d|s|x)(c|f)3|crt(begin|end)S| \
(div|umod|mod)(d|t)i3|emutls|(add|div|sub)tf3| \
(fixtf|float|extend|trunctf)(d|s)(ftf2|i|itf|f2)| \
outline_atomic_(ldadd|swp)(4|8)_4|aarch64| \
floatunsitf|udivmodti4|AMDGPURegAsmNames|clear_cache)"
${FULLSHLIBNAME}: ${SOBJS} ${DPADD}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f ${.TARGET}
.if defined(SYSPATCH_PATH)
@>${.TARGET}.rsp
@for _f in `readelf -Ws ${SYSPATCH_PATH}${LIBDIR}/${.TARGET} | \
awk '/ FILE/{sub(".*/", "", $$NF); gsub(/\.[^.]+$$/, ".so", $$NF); \
print $$NF}' | awk '!x[$$0]++'`; do \
[[ ! -f $${_f} ]] || echo $${_f} >>${.TARGET}.rsp; \
done
${CC} -shared -Wl,-soname,${FULLSHLIBNAME} ${PICFLAG} -o ${.TARGET} \
`readelf -Ws ${SYSPATCH_PATH}${LIBDIR}/${.TARGET} | \
awk '/ FILE/{sub(".*/", "", $$NF); gsub(/\..*/, ".so", $$NF); print $$NF}' | \
egrep -v ${EXCLUDE_REGEX:C/[[:blank:]]//g} | awk '!x[$$0]++'` ${LDADD}
@${.TARGET}.rsp ${LDADD}
@rm -f ${.TARGET}.rsp
.else
${CC} -shared -Wl,-soname,${FULLSHLIBNAME} ${PICFLAG} -o ${.TARGET} \
`echo ${SOBJS} | tr ' ' '\n' | sort -R` ${LDADD}