git: f629a82680ea - stable/13 - Fix cross-builds from macOS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Jul 2023 17:11:22 UTC
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"