diff options
author | nia <nia@pkgsrc.org> | 2021-11-02 08:14:58 +0000 |
---|---|---|
committer | nia <nia@pkgsrc.org> | 2021-11-02 08:14:58 +0000 |
commit | e742f7f0f8e036590c90389b042a41276004607b (patch) | |
tree | 1ceb3f0569145b08a0897adca140edbcad0dc43f | |
parent | f5a85dca2239586798e5b1baf5c224c56072c1c2 (diff) | |
download | pkgsrc-e742f7f0f8e036590c90389b042a41276004607b.tar.gz |
mk: Make it possible for a package to fall back to partial RELRO.
This helps certain X.Org modules.
-rw-r--r-- | mk/bsd.prefs.mk | 4 | ||||
-rw-r--r-- | mk/compiler/clang.mk | 11 | ||||
-rw-r--r-- | mk/compiler/gcc.mk | 11 |
3 files changed, 14 insertions, 12 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index df0d5081256..dddd8cfebd4 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.409 2021/07/02 12:03:24 nia Exp $ +# $NetBSD: bsd.prefs.mk,v 1.410 2021/11/02 08:14:58 nia Exp $ # # This file includes the mk.conf file, which contains the user settings. # @@ -749,7 +749,7 @@ _PKGSRC_USE_FORTIFY= yes # _PKGSRC_USE_RELRO= no .if ${PKGSRC_USE_RELRO:tl} != "no" && \ - ${RELRO_SUPPORTED:Uyes:tl} == "yes" && \ + ${RELRO_SUPPORTED:Uyes:tl} != "no" && \ ${_OPSYS_SUPPORTS_RELRO:Uno} == "yes" _PKGSRC_USE_RELRO= yes .endif diff --git a/mk/compiler/clang.mk b/mk/compiler/clang.mk index 55fedbadeb0..e6bcdce47a2 100644 --- a/mk/compiler/clang.mk +++ b/mk/compiler/clang.mk @@ -1,4 +1,4 @@ -# $NetBSD: clang.mk,v 1.28 2021/10/04 14:21:21 nia Exp $ +# $NetBSD: clang.mk,v 1.29 2021/11/02 08:14:58 nia Exp $ # # This is the compiler definition for the clang compiler. # @@ -55,11 +55,12 @@ _COMPILER_RPATH_FLAG= ${_COMPILER_LD_FLAG}${_LINKER_RPATH_FLAG} _CTF_CFLAGS= -gdwarf-2 -# The user can choose the level of RELRO. -.if ${PKGSRC_USE_RELRO} == "partial" -_RELRO_LDFLAGS= -Wl,-zrelro -.else +# The user or package can choose the level of RELRO. +.if ${PKGSRC_USE_RELRO} != "partial" && \ + ${RELRO_SUPPORTED:Uyes:tl} != "partial" _RELRO_LDFLAGS= -Wl,-zrelro -Wl,-znow +.else +_RELRO_LDFLAGS= -Wl,-zrelro .endif # The user can choose the level of stack smashing protection. diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk index 417694e7d88..14c0e8768a8 100644 --- a/mk/compiler/gcc.mk +++ b/mk/compiler/gcc.mk @@ -1,4 +1,4 @@ -# $NetBSD: gcc.mk,v 1.229 2021/10/08 16:35:57 nia Exp $ +# $NetBSD: gcc.mk,v 1.230 2021/11/02 08:14:58 nia Exp $ # # This is the compiler definition for the GNU Compiler Collection. # @@ -385,11 +385,12 @@ _GCC_CFLAGS+= ${_FORTIFY_CFLAGS} CWRAPPERS_APPEND.cc+= ${_FORTIFY_CFLAGS} .endif -# The user can choose the level of RELRO. -.if ${PKGSRC_USE_RELRO} == "partial" -_RELRO_LDFLAGS= -Wl,-zrelro -.else +# The user or package can choose the level of RELRO. +.if ${PKGSRC_USE_RELRO} != "partial" && \ + ${RELRO_SUPPORTED:Uyes:tl} != "partial" _RELRO_LDFLAGS= -Wl,-zrelro -Wl,-znow +.else +_RELRO_LDFLAGS= -Wl,-zrelro .endif _STACK_CHECK_CFLAGS= -fstack-check |