From fb8ff56467d4b6f7569b6160a85ff23e6cc254df Mon Sep 17 00:00:00 2001 From: sthen Date: Mon, 9 Jan 2023 17:08:50 +0000 Subject: [PATCH] With some ports it's difficult to add linker flags, so reuse the ld wrapper script infrastructure previously used for USE_WXNEEDED to allow adding --no-execute-only by setting USE_NOEXECONLY=Yes in the port. This isn't ideal for compilers (in cases where those can't be made to work with exec-only they need patching to add to the internally constructed linker command line, though it does at least help with initial testing there), and is useful for some other ports. ok tb@ --- infrastructure/mk/bsd.port.mk | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/infrastructure/mk/bsd.port.mk b/infrastructure/mk/bsd.port.mk index a5306429c0b..9fdbb92eb14 100644 --- a/infrastructure/mk/bsd.port.mk +++ b/infrastructure/mk/bsd.port.mk @@ -1,6 +1,6 @@ #-*- mode: Makefile; tab-width: 4; -*- # ex:ts=4 sw=4 filetype=make: -# $OpenBSD: bsd.port.mk,v 1.1581 2022/11/16 17:42:18 espie Exp $ +# $OpenBSD: bsd.port.mk,v 1.1582 2023/01/09 17:08:50 sthen Exp $ # # bsd.port.mk - 940820 Jordan K. Hubbard. # This file is in the public domain. @@ -137,7 +137,7 @@ _ALL_VARIABLES += BROKEN COMES_WITH \ SHARED_LIBS TARGETS PSEUDO_FLAVOR \ AUTOCONF_VERSION AUTOMAKE_VERSION CONFIGURE_ARGS \ GH_ACCOUNT GH_COMMIT GH_PROJECT GH_TAGNAME \ - MAKEFILE_LIST USE_LLD USE_WXNEEDED COMPILER \ + MAKEFILE_LIST USE_LLD USE_NOEXECONLY USE_WXNEEDED COMPILER \ COMPILER_LANGS COMPILER_LINKS SUBST_VARS UPDATE_PLIST_ARGS \ PKGPATHS DEBUG_PACKAGES DEBUG_CONFIGURE_ARGS \ FIX_CRLF_FILES @@ -403,9 +403,14 @@ BASELOCALSTATEDIR ?= ${VARBASE} LOCALSTATEDIR ?= ${BASELOCALSTATEDIR} RCDIR ?= /etc/rc.d +USE_NOEXECONLY ?= No +_LINKER_FLAGS ?= +.if ${USE_NOEXECONLY:L} == "yes" +_LINKER_FLAGS += --no-execute-only +.endif USE_WXNEEDED ?= No .if ${USE_WXNEEDED:L} == "yes" -_WXNEEDED_FLAGS = -z wxneeded +_LINKER_FLAGS += -z wxneeded .endif USE_GMAKE ?= No .if ${USE_GMAKE:L} == "yes" @@ -2857,8 +2862,8 @@ _post-patch-finalize: false; \ fi .endif -.if ${USE_WXNEEDED:L} == "yes" || ${_NONDEFAULT_LD:L} == "yes" - @printf '#!/bin/sh\nexec ${_LD_PROGRAM} ${_WXNEEDED_FLAGS} "$$@"\n' >${WRKDIR}/bin/ld +.if !empty(_LINKER_FLAGS) || ${_NONDEFAULT_LD:L} == "yes" + @printf '#!/bin/sh\nexec ${_LD_PROGRAM} ${_LINKER_FLAGS} "$$@"\n' >${WRKDIR}/bin/ld @chmod 555 ${WRKDIR}/bin/ld .endif .for _wrap _comp in ${COMPILER_LINKS}