The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7927452ac4e98309bd832d55526cc98438fba8a5
commit 7927452ac4e98309bd832d55526cc98438fba8a5 Author: Ed Maste <ema...@freebsd.org> AuthorDate: 2022-06-26 17:23:39 +0000 Commit: Ed Maste <ema...@freebsd.org> CommitDate: 2022-06-27 14:22:12 +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 --- 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 9ba08a7ca619..8fa23f6da9bf 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -79,11 +79,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 eed7d652fad1..c53ecd8a4dc2 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"