public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
To: libc-stable@sourceware.org
Cc: carlos@redhat.com, fweimer@redhat.com,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: [committed 2.34 6/8] Enable _FORTIFY_SOURCE=3 for gcc 12 and above
Date: Fri, 11 Mar 2022 20:42:01 +0530	[thread overview]
Message-ID: <20220311151203.3585163-7-siddhesh@sourceware.org> (raw)
In-Reply-To: <20220311151203.3585163-1-siddhesh@sourceware.org>

gcc 12 now has support for the __builtin_dynamic_object_size builtin.
Adapt the macro checks to enable _FORTIFY_SOURCE=3 on gcc 12 and above.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
(cherry picked from commit 86bf0feb0e3ec8e37872f72499d6ae33406561d7)
---
 include/features.h | 4 +++-
 misc/sys/cdefs.h   | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/features.h b/include/features.h
index d974eabfaf..933499bcff 100644
--- a/include/features.h
+++ b/include/features.h
@@ -412,7 +412,9 @@
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
 # elif !__GNUC_PREREQ (4, 1)
 #  warning _FORTIFY_SOURCE requires GCC 4.1 or later
-# elif _FORTIFY_SOURCE > 2 && __glibc_clang_prereq (9, 0)
+# elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0)		      \
+			       || __GNUC_PREREQ (12, 0))
+
 #  if _FORTIFY_SOURCE > 3
 #   warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform
 #  endif
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 3bb9f38916..515fb681a0 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -142,7 +142,8 @@
 #define __bos0(ptr) __builtin_object_size (ptr, 0)
 
 /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available.  */
-#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0)
+#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0)		      \
+				 || __GNUC_PREREQ (12, 0))
 # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
 # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
 #else
-- 
2.35.1


  parent reply	other threads:[~2022-03-11 15:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 15:11 [committed 2.34 0/8] _FORTIFY_SOURCE=3 and fixes Siddhesh Poyarekar
2022-03-11 15:11 ` [committed 2.34 1/8] Don't add access size hints to fortifiable functions Siddhesh Poyarekar
2022-03-11 15:11 ` [committed 2.34 2/8] Make sure that the fortified function conditionals are constant Siddhesh Poyarekar
2022-03-11 15:11 ` [committed 2.34 3/8] debug: Add tests for _FORTIFY_SOURCE=3 Siddhesh Poyarekar
2022-03-11 15:11 ` [committed 2.34 4/8] __glibc_unsafe_len: Fix comment Siddhesh Poyarekar
2022-03-11 15:12 ` [committed 2.34 5/8] fortify: Fix spurious warning with realpath Siddhesh Poyarekar
2022-03-11 15:12 ` Siddhesh Poyarekar [this message]
2022-03-11 15:12 ` [committed 2.34 7/8] debug: Autogenerate _FORTIFY_SOURCE tests Siddhesh Poyarekar
2022-03-11 15:12 ` [committed 2.34 8/8] debug: Synchronize feature guards in fortified functions [BZ #28746] Siddhesh Poyarekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220311151203.3585163-7-siddhesh@sourceware.org \
    --to=siddhesh@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-stable@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).