pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk/compiler



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Tue Oct  3 09:38:16 UTC 2017

Modified Files:
        pkgsrc/mk/compiler: gcc.mk

Log Message:
mk: Fix SSP detection when using pkgsrc GCC.

We can't rely on _GCC_VERSION as an accurate indicator of the GCC version,
as when using a pkgsrc GCC it will be set to 0 until the pkgsrc GCC is
available and we can detect its version.  Instead, move the logic later to
after CC_VERSION is set and use that instead.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 pkgsrc/mk/compiler/gcc.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/compiler/gcc.mk
diff -u pkgsrc/mk/compiler/gcc.mk:1.184 pkgsrc/mk/compiler/gcc.mk:1.185
--- pkgsrc/mk/compiler/gcc.mk:1.184     Mon Sep 11 09:06:41 2017
+++ pkgsrc/mk/compiler/gcc.mk   Tue Oct  3 09:38:16 2017
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.184 2017/09/11 09:06:41 jperkin Exp $
+# $NetBSD: gcc.mk,v 1.185 2017/10/03 09:38:16 jperkin Exp $
 #
 # This is the compiler definition for the GNU Compiler Collection.
 #
@@ -371,17 +371,6 @@ _GCC_LDFLAGS+=             ${_RELRO_LDFLAGS}
 CWRAPPERS_APPEND.ld+=  ${_RELRO_LDFLAGS}
 .endif
  
-# The user can choose the level of stack smashing protection.
-.if ${_GCC_VERSION:C/\..*$//} >= 4
-.  if ${PKGSRC_USE_SSP} == "all"
-_SSP_CFLAGS=           -fstack-protector-all
-.  elif ${PKGSRC_USE_SSP} == "strong"
-_SSP_CFLAGS=           -fstack-protector-strong
-.  else
-_SSP_CFLAGS=           -fstack-protector
-.  endif
-.endif
-
 _STACK_CHECK_CFLAGS=   -fstack-check
 
 .if ${_PKGSRC_USE_STACK_CHECK} == "yes"
@@ -877,6 +866,17 @@ CC_VERSION_STRING= ${CC_VERSION}
 CC_VERSION=            ${_GCC_PKG}
 .endif
 
+# The user can choose the level of stack smashing protection.
+.if !empty(CC_VERSION:Mgcc-[4-9]*)
+.  if ${PKGSRC_USE_SSP} == "all"
+_SSP_CFLAGS=           -fstack-protector-all
+.  elif ${PKGSRC_USE_SSP} == "strong"
+_SSP_CFLAGS=           -fstack-protector-strong
+.  else
+_SSP_CFLAGS=           -fstack-protector
+.  endif
+.endif
+
 # Prepend the path to the compiler to the PATH.
 .if !empty(_LANGUAGES.gcc)
 PREPEND_PATH+= ${_GCC_DIR}/bin



Home | Main Index | Thread Index | Old Index