Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2023 17:11:22 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f629a82680ea - stable/13 - Fix cross-builds from macOS
Message-ID:  <202307271711.36RHBMW8082857@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=f629a82680ea9abbd646e43bdc684ed3fb49eaff

commit f629a82680ea9abbd646e43bdc684ed3fb49eaff
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-06-26 17:23:39 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-07-27 17:10:23 +0000

    Fix cross-builds from macOS
    
    The macOS linker does not support -zrelro/-znorelro.  Since it is only
    used to for build tools that run on the host, and WITH_RELRO or
    WITHOUT_RELRO does not matter there, just skip the option.
    
    Reviewed by:    markj
    Fixes:          2f3a961487c9 ("Add RELRO build knob, default to enabled")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35589
    
    (cherry picked from commit 7927452ac4e98309bd832d55526cc98438fba8a5)
---
 share/mk/bsd.lib.mk  | 2 ++
 share/mk/bsd.prog.mk | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 5cd5663e1ca7..900bc00f0f03 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -77,11 +77,13 @@ TAG_ARGS=	-T ${TAGS:[*]:S/ /,/g}
 .if ${MK_BIND_NOW} != "no"
 LDFLAGS+= -Wl,-znow
 .endif
+.if ${LINKER_TYPE} != "macos"
 .if ${MK_RELRO} == "no"
 LDFLAGS+= -Wl,-znorelro
 .else
 LDFLAGS+= -Wl,-zrelro
 .endif
+.endif
 .if ${MK_RETPOLINE} != "no"
 .if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline}
 CFLAGS+= -mretpoline
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 3b9b3277a241..d044fed0aeb7 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -41,11 +41,13 @@ MK_DEBUG_FILES=	no
 .if ${MK_BIND_NOW} != "no"
 LDFLAGS+= -Wl,-znow
 .endif
+.if ${LINKER_TYPE} != "macos"
 .if ${MK_RELRO} == "no"
 LDFLAGS+= -Wl,-znorelro
 .else
 LDFLAGS+= -Wl,-zrelro
 .endif
+.endif
 .if ${MK_PIE} != "no"
 # Static PIE is not yet supported/tested.
 .if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307271711.36RHBMW8082857>