Page MenuHomeFreeBSD

D35589.id107350.diff
No OneTemporary

D35589.id107350.diff

Index: share/mk/bsd.lib.mk
===================================================================
--- share/mk/bsd.lib.mk
+++ share/mk/bsd.lib.mk
@@ -79,11 +79,16 @@
.if ${MK_BIND_NOW} != "no"
LDFLAGS+= -Wl,-znow
.endif
+.if ${LINKER_FEATURES:Mrelro}
.if ${MK_RELRO} == "no"
LDFLAGS+= -Wl,-znorelro
.else
LDFLAGS+= -Wl,-zrelro
.endif
+.else
+.warning Linker does not support relro/norelro, option ignored
+.endif
+.endif
.if ${MK_RETPOLINE} != "no"
.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline}
CFLAGS+= -mretpoline
Index: share/mk/bsd.linker.mk
===================================================================
--- share/mk/bsd.linker.mk
+++ share/mk/bsd.linker.mk
@@ -13,6 +13,7 @@
# linker support for that feature:
#
# - build-id: support for generating a Build-ID note
+# - relro: Relocation Read-Only
# - retpoline: support for generating PLT with retpoline speculative
# execution vulnerability mitigation
#
@@ -112,6 +113,9 @@
.endif
.if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 90000
${X_}LINKER_FEATURES+= ifunc-noplt
+.if ${${X_}LINKER_TYPE} == "lld" || ${${X_}LINKER_TYPE} == "bfd"
+${X_}LINKER_FEATURES+= relro
+.endif
.endif
.endif
.else
Index: share/mk/bsd.prog.mk
===================================================================
--- share/mk/bsd.prog.mk
+++ share/mk/bsd.prog.mk
@@ -41,11 +41,15 @@
.if ${MK_BIND_NOW} != "no"
LDFLAGS+= -Wl,-znow
.endif
+.if ${LINKER_FEATURES:Mrelro}
.if ${MK_RELRO} == "no"
LDFLAGS+= -Wl,-znorelro
.else
LDFLAGS+= -Wl,-zrelro
.endif
+.else
+.warning Linker does not support relro/norelro, option ignored
+.endif
.if ${MK_PIE} != "no"
# Static PIE is not yet supported/tested.
.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no"

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 21, 2:20 AM (40 m, 15 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15993578
Default Alt Text
D35589.id107350.diff (1 KB)

Event Timeline