svn commit: r354689 - head/lib/libc/secure

Kyle Evans kevans at FreeBSD.org
Wed Nov 13 18:21:07 UTC 2019


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


More information about the svn-src-head mailing list