From 14608708809b2357e0803a47773194313a169525 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Mon, 19 Nov 2018 20:48:47 +0000 Subject: [PATCH] Avoid retpolineplt with static linking Statically linked binaries linked with -zretpolineplt crash at startup as lld produces a broken PLT. PR: 233336 Sponsored by: The FreeBSD Foundation --- share/mk/bsd.prog.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 2b151c0af7b..2e5fe36e6f9 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -41,8 +41,11 @@ LDFLAGS+= -Wl,-znow .if ${MK_RETPOLINE} != "no" CFLAGS+= -mretpoline CXXFLAGS+= -mretpoline +# retpolineplt is broken with static linking (PR 233336) +.if !defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO" LDFLAGS+= -Wl,-zretpolineplt .endif +.endif .if defined(CRUNCH_CFLAGS) CFLAGS+=${CRUNCH_CFLAGS} -- 2.45.0