Skip to content

Commit 643afcd

Browse files
riastradhriastradh
authored andcommitted
bsd.prog.mk: Respect LDSTATIC.${PROG}, not LDSTATIC.${PROG}.link.
Take two: make sure to do this only if we're actually making PIEs. PR toolchain/60000: split debug data rules broke ${.TARGET}-dependent flags
1 parent b110c5f commit 643afcd

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

share/mk/bsd.prog.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: bsd.prog.mk,v 1.363 2026/02/14 08:12:27 skrll Exp $
1+
# $NetBSD: bsd.prog.mk,v 1.364 2026/02/14 16:07:25 riastradh Exp $
22
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
33

44
.ifndef HOSTPROG
@@ -38,7 +38,7 @@ CLEANFILES+= a.out [Ee]rrs mklog core *.core .gdbinit
3838
.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
3939
CFLAGS+= ${PIE_CFLAGS}
4040
AFLAGS+= ${PIE_AFLAGS}
41-
LDFLAGS+= ${"${LDSTATIC.${.TARGET}}" == "-static" :? : ${PIE_LDFLAGS}}
41+
# PIE_LDFLAGS added on a per-PROG basis below depending on LDSTATIC.${PROG}
4242
.endif
4343

4444
CFLAGS+= ${COPTS}
@@ -470,6 +470,9 @@ PAXCTL_FLAGS.${_P}= +a
470470
_DPADD.${_P}= ${DPADD} ${DPADD.${_P}}
471471
_LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
472472
_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
473+
.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
474+
_LDFLAGS.${_P}+= ${"${LDSTATIC.${_P}}" == "-static" :? : ${PIE_LDFLAGS}}
475+
.endif
473476
.if ${MKSANITIZER} != "yes"
474477
# Sanitizers don't support static build.
475478
_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}

0 commit comments

Comments
 (0)