[PATCH] BZ #13979- A warning should be issued if FORTIFY_SOURCE is requested but not enabled

Andreas Jaeger aj@suse.com
Mon May 7 21:07:00 GMT 2012


 From bugzilla:

"If a user requests FORTIFY_SOURCE checking, but for whatever reason the 
checks
are not enabled (for example optimizer not enabled), we should issue a 
warning."

Tested on x86-64.

Ok to commit?

Andreas

2012-03-30  Jeff Law  <law@redhat.com>

	* include/features.h: Warn if user requests FORTIFY_SOURCE checking
	but the checks are disabled for any reason.

diff --git a/include/features.h b/include/features.h
index c347555..e3ad8b0 100644
--- a/include/features.h
+++ b/include/features.h
@@ -336,6 +336,10 @@
  # define __USE_FORTIFY_LEVEL 0
  #endif

+#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 && 
__USE_FORTIFY_LEVEL == 0
+# warning _FORTIFY_SOURCE requested but disabled
+#endif
+
  /* Get definitions of __STDC_* predefined macros, if the compiler has
     not preincluded this header automatically.  */
  #include <stdc-predef.h>

-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
   SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
    GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126



More information about the Libc-alpha mailing list