Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2019 18:21:06 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354689 - head/lib/libc/secure
Message-ID:  <201911131821.xADIL66D044326@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Wed Nov 13 18:21:06 2019
New Revision: 354689
URL: https://svnweb.freebsd.org/changeset/base/354689

Log:
  ssp: further refine the conditional used for constructor priority
  
  __has_attribute(__constructor__) is a better test for clang than
  defined(__clang__). Switch to it instead.
  
  While we're already here and touching it, pfg@ nailed down when GCC actually
  introduced the priority argument -- 4.3. Use that instead of our
  hammer-guess of GCC >= 5 for the sake of correctness.

Modified:
  head/lib/libc/secure/stack_protector.c

Modified: head/lib/libc/secure/stack_protector.c
==============================================================================
--- head/lib/libc/secure/stack_protector.c	Wed Nov 13 18:10:42 2019	(r354688)
+++ head/lib/libc/secure/stack_protector.c	Wed Nov 13 18:21:06 2019	(r354689)
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
  *
  * This conditional should be removed when GCC 4.2 is removed.
  */
-#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4)
+#if __has_attribute(__constructor__) || __GNUC_PREREQ__(4, 3)
 #define	_GUARD_SETUP_CTOR_ATTR	 \
     __attribute__((__constructor__ (200), __used__));
 #else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911131821.xADIL66D044326>