Mon Aug 1 07:58:21 2022 UTC ()
mk: add stack-clash option to PKGSRC_USE_STACK_CHECK


(wiz)
diff -r1.424 -r1.425 pkgsrc/mk/bsd.prefs.mk
diff -r1.245 -r1.246 pkgsrc/mk/compiler/gcc.mk
diff -r1.334 -r1.335 pkgsrc/mk/defaults/mk.conf

cvs diff -r1.424 -r1.425 pkgsrc/mk/bsd.prefs.mk (expand / switch to unified diff)

--- pkgsrc/mk/bsd.prefs.mk 2022/07/22 09:27:01 1.424
+++ pkgsrc/mk/bsd.prefs.mk 2022/08/01 07:58:21 1.425
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: bsd.prefs.mk,v 1.424 2022/07/22 09:27:01 nia Exp $ 1# $NetBSD: bsd.prefs.mk,v 1.425 2022/08/01 07:58:21 wiz Exp $
2# 2#
3# This file includes the mk.conf file, which contains the user settings. 3# This file includes the mk.conf file, which contains the user settings.
4# 4#
5# Packages should include this file before any of the .if directives, as 5# Packages should include this file before any of the .if directives, as
6# well as before modifying variables like CFLAGS, LDFLAGS, and so on. 6# well as before modifying variables like CFLAGS, LDFLAGS, and so on.
7# Otherwise the behavior may be unexpected. 7# Otherwise the behavior may be unexpected.
8# 8#
9# When mk.conf is included by this file, the following variables are 9# When mk.conf is included by this file, the following variables are
10# defined: 10# defined:
11# 11#
12# ACCEPTABLE_LICENSES 12# ACCEPTABLE_LICENSES
13# This variable is set to the list of Open Source licenses. See 13# This variable is set to the list of Open Source licenses. See
14# mk/license.mk for details. 14# mk/license.mk for details.
@@ -845,27 +845,31 @@ _PKGSRC_USE_SSP= no @@ -845,27 +845,31 @@ _PKGSRC_USE_SSP= no
845 ${SSP_SUPPORTED:Uyes:tl} == "yes" && \ 845 ${SSP_SUPPORTED:Uyes:tl} == "yes" && \
846 ${_OPSYS_SUPPORTS_SSP:Uno} == "yes" 846 ${_OPSYS_SUPPORTS_SSP:Uno} == "yes"
847_PKGSRC_USE_SSP= yes 847_PKGSRC_USE_SSP= yes
848.endif 848.endif
849 849
850# Enable stack check 850# Enable stack check
851# Generate code to ensure we don't exceed our given stack. 851# Generate code to ensure we don't exceed our given stack.
852# Impact: performance drop 852# Impact: performance drop
853# 853#
854_PKGSRC_USE_STACK_CHECK=no 854_PKGSRC_USE_STACK_CHECK=no
855.if ${PKGSRC_USE_STACK_CHECK:tl} != "no" && \ 855.if ${PKGSRC_USE_STACK_CHECK:tl} != "no" && \
856 ${STACK_CHECK_SUPPORTED:Uyes:tl} == "yes" && \ 856 ${STACK_CHECK_SUPPORTED:Uyes:tl} == "yes" && \
857 ${_OPSYS_SUPPORTS_STACK_CHECK:Uno} == "yes" 857 ${_OPSYS_SUPPORTS_STACK_CHECK:Uno} == "yes"
 858. if ${PKGSRC_USE_STACK_CHECK:tl} == "stack-clash"
 859_PKGSRC_USE_STACK_CHECK=stack-clash
 860. else
858_PKGSRC_USE_STACK_CHECK=yes 861_PKGSRC_USE_STACK_CHECK=yes
 862. endif
859.endif 863.endif
860 864
861# Enable CTF conversion if the user requested it, the OPSYS supports it, there 865# Enable CTF conversion if the user requested it, the OPSYS supports it, there
862# is a tool for it, and the package supports it. We also need to explicitly 866# is a tool for it, and the package supports it. We also need to explicitly
863# turn on _INSTALL_UNSTRIPPED as conversion is impossible on stripped files. 867# turn on _INSTALL_UNSTRIPPED as conversion is impossible on stripped files.
864# 868#
865.if ${PKGSRC_USE_CTF:Uno:tl} == "yes" && \ 869.if ${PKGSRC_USE_CTF:Uno:tl} == "yes" && \
866 ${_OPSYS_SUPPORTS_CTF:Uno:tl} == "yes" && \ 870 ${_OPSYS_SUPPORTS_CTF:Uno:tl} == "yes" && \
867 defined(TOOLS_PLATFORM.ctfconvert) && \ 871 defined(TOOLS_PLATFORM.ctfconvert) && \
868 ${CTF_SUPPORTED:Uyes:tl} == "yes" 872 ${CTF_SUPPORTED:Uyes:tl} == "yes"
869_PKGSRC_USE_CTF= yes 873_PKGSRC_USE_CTF= yes
870_INSTALL_UNSTRIPPED= # defined 874_INSTALL_UNSTRIPPED= # defined
871.else 875.else

cvs diff -r1.245 -r1.246 pkgsrc/mk/compiler/gcc.mk (expand / switch to unified diff)

--- pkgsrc/mk/compiler/gcc.mk 2022/07/07 16:23:39 1.245
+++ pkgsrc/mk/compiler/gcc.mk 2022/08/01 07:58:21 1.246
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: gcc.mk,v 1.245 2022/07/07 16:23:39 jperkin Exp $ 1# $NetBSD: gcc.mk,v 1.246 2022/08/01 07:58:21 wiz Exp $
2# 2#
3# This is the compiler definition for the GNU Compiler Collection. 3# This is the compiler definition for the GNU Compiler Collection.
4# 4#
5# User-settable variables: 5# User-settable variables:
6# 6#
7# GCCBASE 7# GCCBASE
8# If using a native GCC and the compiler is not in $PATH then 8# If using a native GCC and the compiler is not in $PATH then
9# this should be set to the base installation directory. 9# this should be set to the base installation directory.
10# 10#
11# USE_NATIVE_GCC 11# USE_NATIVE_GCC
12# When set to "yes", the native gcc is used, no matter which 12# When set to "yes", the native gcc is used, no matter which
13# compiler version a package requires. 13# compiler version a package requires.
14# 14#
@@ -433,29 +433,31 @@ CWRAPPERS_APPEND.cc+= ${_FORTIFY_CFLAGS} @@ -433,29 +433,31 @@ CWRAPPERS_APPEND.cc+= ${_FORTIFY_CFLAGS}
433 433
434# The user or package can choose the level of RELRO. 434# The user or package can choose the level of RELRO.
435.if ${PKGSRC_USE_RELRO} != "partial" && \ 435.if ${PKGSRC_USE_RELRO} != "partial" && \
436 ${RELRO_SUPPORTED:Uyes:tl} != "partial" 436 ${RELRO_SUPPORTED:Uyes:tl} != "partial"
437_RELRO_LDFLAGS= -Wl,-zrelro -Wl,-znow 437_RELRO_LDFLAGS= -Wl,-zrelro -Wl,-znow
438.else 438.else
439_RELRO_LDFLAGS= -Wl,-zrelro 439_RELRO_LDFLAGS= -Wl,-zrelro
440.endif 440.endif
441 441
442.if !empty(_RELRO_LDFLAGS) && !empty(MACHINE_PLATFORM:MNetBSD-*-*mips*) 442.if !empty(_RELRO_LDFLAGS) && !empty(MACHINE_PLATFORM:MNetBSD-*-*mips*)
443_RELRO_LDFLAGS+= -Wl,-z,common-page-size=0x10000 443_RELRO_LDFLAGS+= -Wl,-z,common-page-size=0x10000
444.endif 444.endif
445 445
446_STACK_CHECK_CFLAGS= -fstack-check 
447 
448.if ${_PKGSRC_USE_STACK_CHECK} == "yes" 446.if ${_PKGSRC_USE_STACK_CHECK} == "yes"
 447_STACK_CHECK_CFLAGS= -fstack-check
 448_GCC_CFLAGS+= ${_STACK_CHECK_CFLAGS}
 449.elif ${_PKGSRC_USE_STACK_CHECK} == "stack-clash"
 450_STACK_CHECK_CFLAGS= -fstack-clash-protection
449_GCC_CFLAGS+= ${_STACK_CHECK_CFLAGS} 451_GCC_CFLAGS+= ${_STACK_CHECK_CFLAGS}
450.endif 452.endif
451 453
452_CTF_CFLAGS= -gdwarf-2 454_CTF_CFLAGS= -gdwarf-2
453 455
454# GCC has this annoying behaviour where it advocates in a multi-line 456# GCC has this annoying behaviour where it advocates in a multi-line
455# banner the use of "#include" over "#import" when including headers. 457# banner the use of "#include" over "#import" when including headers.
456# This generates a huge number of warnings when building practically all 458# This generates a huge number of warnings when building practically all
457# Objective-C code where it is convention to use "#import". Suppress 459# Objective-C code where it is convention to use "#import". Suppress
458# the warning if we're building Objective-C code using GCC. 460# the warning if we're building Objective-C code using GCC.
459# 461#
460.if !empty(_LANGUAGES.gcc:Mobjc) 462.if !empty(_LANGUAGES.gcc:Mobjc)
461CFLAGS+= -Wno-import 463CFLAGS+= -Wno-import

cvs diff -r1.334 -r1.335 pkgsrc/mk/defaults/mk.conf (expand / switch to unified diff)

--- pkgsrc/mk/defaults/mk.conf 2022/06/07 10:04:25 1.334
+++ pkgsrc/mk/defaults/mk.conf 2022/08/01 07:58:21 1.335
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: mk.conf,v 1.334 2022/06/07 10:04:25 jperkin Exp $ 1# $NetBSD: mk.conf,v 1.335 2022/08/01 07:58:21 wiz Exp $
2# 2#
3 3
4# This file provides default values for variables that may be overridden 4# This file provides default values for variables that may be overridden
5# in the MAKECONF file, which is /etc/mk.conf by default. 5# in the MAKECONF file, which is /etc/mk.conf by default.
6# 6#
7# Note: This file is included after the MAKECONF file, so you cannot query 7# Note: This file is included after the MAKECONF file, so you cannot query
8# these default values in the MAKECONF using the ".if" and ".for" 8# these default values in the MAKECONF using the ".if" and ".for"
9# preprocessing directives. 9# preprocessing directives.
10 10
11# ************************************************************************ 11# ************************************************************************
12# NOTE TO PEOPLE EDITING THIS FILE - USE LEADING SPACES, NOT LEADING TABS. 12# NOTE TO PEOPLE EDITING THIS FILE - USE LEADING SPACES, NOT LEADING TABS.
13# ************************************************************************ 13# ************************************************************************
14 14
@@ -295,28 +295,29 @@ PKGSRC_USE_SSP?= strong @@ -295,28 +295,29 @@ PKGSRC_USE_SSP?= strong
295# Configure this to enable stack smashing protection (on supported platforms). 295# Configure this to enable stack smashing protection (on supported platforms).
296# Possible values: 296# Possible values:
297# no: Do not pass any stack protection flags 297# no: Do not pass any stack protection flags
298# yes: Pass -fstack-protector 298# yes: Pass -fstack-protector
299# strong: Pass -fstack-protector-strong 299# strong: Pass -fstack-protector-strong
300# all: Pass -fstack-protector-all 300# all: Pass -fstack-protector-all
301# Default: strong 301# Default: strong
302# 302#
303# Keywords: ssp 303# Keywords: ssp
304 304
305PKGSRC_USE_STACK_CHECK?= no 305PKGSRC_USE_STACK_CHECK?= no
306# Configure this to enable stack boundary verification (on supported platforms). 306# Configure this to enable stack boundary verification (on supported platforms).
307# Possible values: 307# Possible values:
308# no: Do not pass any stack protection flags 308# no: Do not pass any stack protection flags
309# yes: Pass -fstack-check 309# yes: Pass -fstack-check
 310# clash-protection: Pass -fstack-clash-protection
310# Default: no 311# Default: no
311 312
312# The default PREFER_PKGSRC should be empty, but due to historical reasons we have the list below. 313# The default PREFER_PKGSRC should be empty, but due to historical reasons we have the list below.
313# Please add your platform here once you have confirmed it is correct 314# Please add your platform here once you have confirmed it is correct
314.if ${OPSYS} == "OpenBSD" || ${OPSYS} == "Bitrig" 315.if ${OPSYS} == "OpenBSD" || ${OPSYS} == "Bitrig"
315PREFER_PKGSRC?= 316PREFER_PKGSRC?=
316.elif (!empty(MACHINE_PLATFORM:MNetBSD-*-*) && \ 317.elif (!empty(MACHINE_PLATFORM:MNetBSD-*-*) && \
317 exists(/usr/X11R7/lib/libX11.so)) 318 exists(/usr/X11R7/lib/libX11.so))
318PREFER_PKGSRC?= 319PREFER_PKGSRC?=
319.elif (!empty(MACHINE_PLATFORM:MNetBSD-*-*) && \ 320.elif (!empty(MACHINE_PLATFORM:MNetBSD-*-*) && \
320 exists(/usr/lib/libexpat.so)) 321 exists(/usr/lib/libexpat.so))
321PREFER_PKGSRC?= MesaLib Xft2 Xrandr Xrender fontconfig \ 322PREFER_PKGSRC?= MesaLib Xft2 Xrandr Xrender fontconfig \
322 freetype2 glu xcursor 323 freetype2 glu xcursor