public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/
Date: Mon, 12 Feb 2024 07:03:33 +0000 (UTC)	[thread overview]
Message-ID: <1707717429.fa67a66af82ec9fd027c01acb862fe6dbd86bf78.sam@gentoo> (raw)

commit:     fa67a66af82ec9fd027c01acb862fe6dbd86bf78
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 12 05:56:45 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 12 05:57:09 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fa67a66a

13.2.0: drop 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch

Backported upstream.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...tdc-Prefer-posix_memalign-for-aligned-new.patch | 97 ----------------------
 13.2.0/gentoo/README.history                       |  4 +
 2 files changed, 4 insertions(+), 97 deletions(-)

diff --git a/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch b/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
deleted file mode 100644
index a03f268..0000000
--- a/13.2.0/gentoo/91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-https://gcc.gnu.org/PR113258
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f50f2efae9fb0965d8ccdb62cfdb698336d5a933
-
-From d17158058fee187e7efb918145c87bdfff9cbfa3 Mon Sep 17 00:00:00 2001
-From: Jonathan Wakely <jwakely@redhat.com>
-Date: Tue, 9 Jan 2024 15:22:46 +0000
-Subject: [PATCH] libstdc++: Prefer posix_memalign for aligned-new [PR113258]
-
-As described in PR libstdc++/113258 there are old versions of tcmalloc
-which replace malloc and related APIs, but do not repalce aligned_alloc
-because it didn't exist at the time they were released. This means that
-when operator new(size_t, align_val_t) uses aligned_alloc to obtain
-memory, it comes from libc's aligned_alloc not from tcmalloc. But when
-operator delete(void*, size_t, align_val_t) uses free to deallocate the
-memory, that goes to tcmalloc's replacement version of free, which
-doesn't know how to free it.
-
-If we give preference to the older posix_memalign instead of
-aligned_alloc then we're more likely to use a function that will be
-compatible with the replacement version of free. Because posix_memalign
-has been around for longer, it's more likely that old third-party malloc
-replacements will also replace posix_memalign alongside malloc and free.
-
-libstdc++-v3/ChangeLog:
-
-	PR libstdc++/113258
-	* libsupc++/new_opa.cc: Prefer to use posix_memalign if
-	available.
-
-(cherry picked from commit f50f2efae9fb0965d8ccdb62cfdb698336d5a933)
----
- libstdc++-v3/libsupc++/new_opa.cc | 26 +++++++++++++++-----------
- 1 file changed, 15 insertions(+), 11 deletions(-)
-
-diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
-index 6eb136fa8fc7..29767c1cfaad 100644
---- a/libstdc++-v3/libsupc++/new_opa.cc
-+++ b/libstdc++-v3/libsupc++/new_opa.cc
-@@ -46,12 +46,12 @@ using std::bad_alloc;
- using std::size_t;
- extern "C"
- {
--# if _GLIBCXX_HAVE_ALIGNED_ALLOC
-+# if _GLIBCXX_HAVE_POSIX_MEMALIGN
-+  void *posix_memalign(void **, size_t alignment, size_t size);
-+# elif _GLIBCXX_HAVE_ALIGNED_ALLOC
-   void *aligned_alloc(size_t alignment, size_t size);
- # elif _GLIBCXX_HAVE__ALIGNED_MALLOC
-   void *_aligned_malloc(size_t size, size_t alignment);
--# elif _GLIBCXX_HAVE_POSIX_MEMALIGN
--  void *posix_memalign(void **, size_t alignment, size_t size);
- # elif _GLIBCXX_HAVE_MEMALIGN
-   void *memalign(size_t alignment, size_t size);
- # else
-@@ -63,13 +63,10 @@ extern "C"
- #endif
- 
- namespace __gnu_cxx {
--#if _GLIBCXX_HAVE_ALIGNED_ALLOC
--using ::aligned_alloc;
--#elif _GLIBCXX_HAVE__ALIGNED_MALLOC
--static inline void*
--aligned_alloc (std::size_t al, std::size_t sz)
--{ return _aligned_malloc(sz, al); }
--#elif _GLIBCXX_HAVE_POSIX_MEMALIGN
-+// Prefer posix_memalign if available, because it's older than aligned_alloc
-+// and so more likely to be provided by replacement malloc libraries that
-+// predate the addition of aligned_alloc. See PR libstdc++/113258.
-+#if _GLIBCXX_HAVE_POSIX_MEMALIGN
- static inline void*
- aligned_alloc (std::size_t al, std::size_t sz)
- {
-@@ -83,6 +80,12 @@ aligned_alloc (std::size_t al, std::size_t sz)
-     return ptr;
-   return nullptr;
- }
-+#elif _GLIBCXX_HAVE_ALIGNED_ALLOC
-+using ::aligned_alloc;
-+#elif _GLIBCXX_HAVE__ALIGNED_MALLOC
-+static inline void*
-+aligned_alloc (std::size_t al, std::size_t sz)
-+{ return _aligned_malloc(sz, al); }
- #elif _GLIBCXX_HAVE_MEMALIGN
- static inline void*
- aligned_alloc (std::size_t al, std::size_t sz)
-@@ -128,7 +131,8 @@ operator new (std::size_t sz, std::align_val_t al)
-   if (__builtin_expect (sz == 0, false))
-     sz = 1;
- 
--#if _GLIBCXX_HAVE_ALIGNED_ALLOC
-+#if _GLIBCXX_HAVE_POSIX_MEMALIGN
-+#elif _GLIBCXX_HAVE_ALIGNED_ALLOC
- # if defined _AIX || defined __APPLE__
-   /* AIX 7.2.0.0 aligned_alloc incorrectly has posix_memalign's requirement
-    * that alignment is a multiple of sizeof(void*).
--- 
-2.43.0

diff --git a/13.2.0/gentoo/README.history b/13.2.0/gentoo/README.history
index 3a6ad75..125a634 100644
--- a/13.2.0/gentoo/README.history
+++ b/13.2.0/gentoo/README.history
@@ -1,3 +1,7 @@
+13	12 Feb 2024
+
+	- 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch
+
 12	17 Jan 2024
 
 	+ 91_all_PR113258_libstdc-Prefer-posix_memalign-for-aligned-new.patch


             reply	other threads:[~2024-02-12  7:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  7:03 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-29 18:56 [gentoo-commits] proj/gcc-patches:master commit in: 13.2.0/gentoo/ Sam James
2024-09-29 18:56 Sam James
2024-07-27 19:47 Sam James
2024-06-08 17:01 Sam James
2024-05-10 22:50 Sam James
2024-04-07 23:25 Sam James
2024-04-07 23:25 Sam James
2024-02-28  0:29 Sam James
2024-01-17  1:06 Sam James
2023-12-03  3:18 Sam James
2023-11-29 20:25 Sam James
2023-11-29 20:16 Sam James
2023-10-27 23:43 Sam James
2023-10-16 12:41 Sam James
2023-10-01  2:28 Sam James
2023-10-01  2:28 Sam James
2023-10-01  2:28 Sam James
2023-08-14  9:31 Sam James
2023-08-13  0:35 Sam James
2023-08-05 23:13 Sam James
2023-07-30 19:02 Sam James
2023-05-26  2:50 Sam James
2023-04-29 23:28 Sam James
2023-04-26 20:39 Sam James

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=1707717429.fa67a66af82ec9fd027c01acb862fe6dbd86bf78.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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