This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 1/2] Fix attributes for fortify functions
- From: Marek Polacek <polacek at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Sun, 22 Apr 2012 20:18:18 +0200
- Subject: [PATCH 1/2] Fix attributes for fortify functions
- References: <20120422181326.GA27852@redhat.com>
2012-04-22 Marek Polacek <polacek@redhat.com>
* misc/sys/cdefs.h: Define __fortify_function macro. Don't
contain __attribute__ ((__artificial__)) in __extern_always_inline.
Define __attribute_artificial__.
--- libc/misc/sys/cdefs.h.mp 2012-04-15 13:32:42.577179773 +0200
+++ libc/misc/sys/cdefs.h 2012-04-19 13:36:53.686329821 +0200
@@ -140,6 +140,7 @@
/* Fortify support. */
#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
#define __bos0(ptr) __builtin_object_size (ptr, 0)
+#define __fortify_function __extern_always_inline __attribute_artificial__
#if __GNUC_PREREQ (4,3)
# define __warndecl(name, msg) \
@@ -309,26 +310,23 @@
# define __always_inline __inline
#endif
+/* This tells the debugger to not step through the inlined instructions. */
+#if __GNUC_PREREQ (4,3)
+# define __attribute_artificial__ __attribute__ ((__artificial__))
+#else
+# define __attribute_artificial__ /* Ignore */
+#endif
+
/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
inline semantics, unless -fgnu89-inline is used. */
#if !defined __cplusplus || __GNUC_PREREQ (4,3)
# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
-# if __GNUC_PREREQ (4,3)
-# define __extern_always_inline \
- extern __always_inline __attribute__ ((__gnu_inline__, __artificial__))
-# else
-# define __extern_always_inline \
+# define __extern_always_inline \
extern __always_inline __attribute__ ((__gnu_inline__))
-# endif
# else
# define __extern_inline extern __inline
-# if __GNUC_PREREQ (4,3)
-# define __extern_always_inline \
- extern __always_inline __attribute__ ((__artificial__))
-# else
-# define __extern_always_inline extern __always_inline
-# endif
+# define __extern_always_inline extern __always_inline
# endif
#endif