summaryrefslogtreecommitdiff
path: root/dev-debug/valgrind
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-13 19:12:15 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-13 19:12:15 +0000
commita7ec94f7d22ee22df2e424c1d3f842510b7993aa (patch)
treef35dc4a8ebf81ae4e8802aa6d4347ce28a1e25f5 /dev-debug/valgrind
parent7860ad41012a3808c645607818b64ad7dab025e9 (diff)
gentoo auto-resync : 13:01:2024 - 19:12:15
Diffstat (limited to 'dev-debug/valgrind')
-rw-r--r--dev-debug/valgrind/Manifest20
-rw-r--r--dev-debug/valgrind/files/valgrind-3.13.0-malloc.patch24
-rw-r--r--dev-debug/valgrind/files/valgrind-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch22
-rw-r--r--dev-debug/valgrind/files/valgrind-3.20.0-gcc-13.patch44
-rw-r--r--dev-debug/valgrind/files/valgrind-3.20.0-musl-interpose.patch30
-rw-r--r--dev-debug/valgrind/files/valgrind-3.20.0-tests-clang16.patch23
-rw-r--r--dev-debug/valgrind/files/valgrind-3.21.0-glibc-2.34-suppressions.patch197
-rw-r--r--dev-debug/valgrind/files/valgrind-3.21.0-memcpy-fortify_source.patch26
-rw-r--r--dev-debug/valgrind/files/valgrind-3.7.0-respect-flags.patch13
-rw-r--r--dev-debug/valgrind/metadata.xml27
-rw-r--r--dev-debug/valgrind/valgrind-3.20.0-r2.ebuild141
-rw-r--r--dev-debug/valgrind/valgrind-3.21.0-r1.ebuild132
-rw-r--r--dev-debug/valgrind/valgrind-3.21.0-r2.ebuild139
-rw-r--r--dev-debug/valgrind/valgrind-3.22.0.ebuild152
-rw-r--r--dev-debug/valgrind/valgrind-9999.ebuild152
15 files changed, 1142 insertions, 0 deletions
diff --git a/dev-debug/valgrind/Manifest b/dev-debug/valgrind/Manifest
new file mode 100644
index 000000000000..b32e4c100f92
--- /dev/null
+++ b/dev-debug/valgrind/Manifest
@@ -0,0 +1,20 @@
+AUX valgrind-3.13.0-malloc.patch 1024 BLAKE2B 3917fe49e5b7f8f678801edd3236b76fbc3eaf790bc19db7a1055cd949df802fc7612b8ec8fb40371814790d24f15fc2cdfd5349297ed5b48e28d3224bb2d170 SHA512 57086a768f3876b26b0e507bc159a73f0955f03d5af8cc30e21103e348ca67f2e58b5555a5a97f299751c6602692ad43d8346bb68a80917d740fb4d65bba9665
+AUX valgrind-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch 650 BLAKE2B ffb545d6af214a5bd43ff800d52e0d7cfc03feac8d2466da8d4935db659172cd50cf3e2d63b3aff46d81b21846b304671506cd235b710037218fc16e0ef66438 SHA512 7cb5a46c2d8ed4360053289994014b334e32d48b0608ed58662486bd432c31835ef16e2cdfd734f3e4d720e272d2507ec76f0b77e1364237e9f6dbbd97a8abb6
+AUX valgrind-3.20.0-gcc-13.patch 1181 BLAKE2B a7cdca7b99e822444ab3c453efba979a341c31ad0882a8a8232ba96af4ccc94277b142a833435afc911b06b743c5bc6e7bd126b7f65246308147130ab0ee86c4 SHA512 c4d14851f7ea41d8b3f8391f3e2c0fd72afae0944594d126bf2d3dbbf65fd3cd5fdf5303c4b7b3f40c5fe48f0e965dcd6265d268b8e3483c9354ede8e5c53af5
+AUX valgrind-3.20.0-musl-interpose.patch 904 BLAKE2B c2f3e1942bf1a713c993d63ee7e69506feed7dd0c34b906b3b65fa065ea9fff081c49b8ed4341f3f48350b22235bbc0896ebf099a5ea211fe9d502efe899851e SHA512 74a2f29a68ff5d7c10d829469302946982c2ff558f5a9b08d0f6e74a5e73a713461838469efc11b5bf93212d67f9e2922aed3c6f7d772bb037eeb461f2cc6729
+AUX valgrind-3.20.0-tests-clang16.patch 715 BLAKE2B d81ca99227e8175d9ab4ad5e6c706e5033d25527ac9ff7fe784cfded3dd42783c0c27dfa7c97908cb50ce24d2b6ceecaa220e79fc6d77ac9e322ebf86ff2fd5a SHA512 e3d79c67d1589c6fdb26018b146ddf896aa19e5b45ce15ae6d6ef449c72c0ba151c2903e6600ae33a7f76205562f094fbe5d4ed3370ded87d2216d25b5b62b23
+AUX valgrind-3.21.0-glibc-2.34-suppressions.patch 4800 BLAKE2B ea36d61be93ca26b301f78bd4f1ea8b7f6769253101858bf27ae5ffddef5375ed1c0627ec648b7310e43a9546ae2a3c0c28ec4e6e6947e68ab8a2f0b0fa0fe27 SHA512 c21d0b7dbe91683669e92cc9f93d0912987b5b241116df08a48eaf422d9961f2c83398a2d8610c22d8cbf5bddf6f1ab8e08c3cdd1ed77b51269f3584cd8a2622
+AUX valgrind-3.21.0-memcpy-fortify_source.patch 1058 BLAKE2B df5e131dd7c01f0d7cf0b2c5b3ed484d1cebf34fd8f5ae10d37aea36e17903db9f243ccf35962c7b1da225cb8b413810911eae55eddadd5aeaafef3afb2d5f56 SHA512 e52233d187c7594773e00d1531b4488c684e8764b715ea0ec7ec24380c4ac8c1ddf104eb35eb3cc0fdc5f301a1365989bb0f1690b25947935e7c9247364d3c2d
+AUX valgrind-3.7.0-respect-flags.patch 360 BLAKE2B 020b9e3af2c6393193edd8be99ff2309f4b138915bd0315090cebd902747678a5b655a8178a8ec8e88782286470922aed505d2a69d6da4d295fd2053d640b035 SHA512 efdb017283b6a5829d1a5acc31b42ddd177a3ab468eb062b8c4fd90b2dbd06679e8d8bc2d6f813e3001efdda831d4410cc8da3a3e42ee2e49efea0423e4b3ca3
+DIST valgrind-3.20.0.tar.bz2 16469274 BLAKE2B 8217dcfc185c7f6601fedd8d53bb35d260b985b8049c8c73a26151db6650b1607e8e53b614652c40962ea7382b9301c4b234a933c8d81f57e649ebf3f703e630 SHA512 d6bfb9284d0410134ee7e2a5975b13c01508dd5587b562947d8197b3c113b76fdfac88c4072948be68bbf0dbeb17b4d1acb1412ce898adaa83c30ae2c6a1c12b
+DIST valgrind-3.20.0.tar.bz2.asc 488 BLAKE2B 12642e4f85c7b17bdb892221f74d80ce919554ffde3cdfa79ca27f4c5f8b48dac699084b8296b5cea285b5af660a0bc51c42b108a725be60002b14f0fda7eac7 SHA512 70dd20f15b159ffbf016c118046ee42160dd867415f1c565a92995952b1720ec36fc48557f6b523d28e6f675d62df10a4022e900fa4a104626b9e6ed6fe9ad6d
+DIST valgrind-3.21.0.tar.bz2 17449484 BLAKE2B 1f7306d288eb5ecfb2b2f0b2dc68960ecd4a7213b96a2e4ecb9990a755e8c233b0e9d190c0f807019bde669f44a631c8dafe9eb521d739561e6f889f7bdaca5c SHA512 3e86cda2f2d6cd30807fac7933ba2c46a97a2b4a868db989e6b0cceeadf029af7ee34ba900466a346948289aacb30f4399799bb83b97cc49a4d2d810441e5cfd
+DIST valgrind-3.21.0.tar.bz2.asc 488 BLAKE2B 6297bc925c16526a51de4f589232a8d5bcb8d54bdc885c145d329deeba45b42d3a5a8a3f59d3fb240d3bd78be7fd30d95ceb33c7624afd3c99c51833d0fd16f2 SHA512 114e5cd2f7352e56099efa3b2c42d39ed24e42419bbaac1af5e2b5c4fa72a2ba38ac6b0c60b93460a0cce8819ca0c7fae6618599b2af809ac0ab4fa30fdb25ba
+DIST valgrind-3.22.0.tar.bz2 16565502 BLAKE2B 80024371b3e70521996077fba24e233097a6190477ced1b311cd41fead687dcc2511ac0ef723792488f4af08867dff3e1f474816fda09c1604b89059e31c2514 SHA512 2904c13f68245bbafcea70998c6bd20725271300a7e94b6751ca00916943595fc3fac8557da7ea8db31b54a43f092823a0a947bc142829da811d074e1fe49777
+DIST valgrind-3.22.0.tar.bz2.asc 488 BLAKE2B 9e4d4cfac4dcc09bb62beeaa7b9f78bfafd0a6ae8d63e423ff81b7b8f5444a301e4c3030a241644c8070c36ee040832ce99f444678f22611457e325ceae18dd1 SHA512 c2317db564ef816d2b5d1a7f2f680dc1c6ea05abbffde660587946c986af179ea7ca2314d94c792f63f3043b6a44819ddf5661fd60ec2454a2c562e7d2711b36
+EBUILD valgrind-3.20.0-r2.ebuild 4290 BLAKE2B a948bd03fabd0b5f7b7aab5e7b38d2e2d109f93f9f60575a03dc591664d81758e924634a8e56c9b6a7baf0b616a2ad820ebdff6e2cf852308552b18b9d0bf6d0 SHA512 e859ab336717bd76a8341c94cfac95d222d4f8faabae0f13b833272951bb94e96fe4d51e7627d47bab44d204e9ba093f97d328e385e17e58834b149e8d442d73
+EBUILD valgrind-3.21.0-r1.ebuild 4077 BLAKE2B cfee838cfd981a10f1e5eadfdee7e8ebee5fdd0333d3e8e0b73e3b006defaa26ec909263e6cd4938e89c84b28910d951c9aff9668f027f9a3483e507431616ea SHA512 12aef097f3358d7ecfc4a64d59b00339b0ec052ba7b54b662c963b60fe18c5e89cc218991d5667de9c9152c64b6910b7a31a8a5897113ba847cb4fa43a4ad9e6
+EBUILD valgrind-3.21.0-r2.ebuild 4449 BLAKE2B 8079d0980286a026dfe0a00be78b2cc9f9f2732dd9909dd35e2019bef9f9fb692bd5d0e682834a761937c8ce6d1d38301758dda2ba099172010d6f90541dad50 SHA512 8ef4c0c5422a2c8a37be2a45022020edb8f5a09cbd5d639df49ea089815b7ee5bea3b5fb9b0d2202f00d4e4c40783cd39a3de7bdfff4980700e9d3f513463e71
+EBUILD valgrind-3.22.0.ebuild 4787 BLAKE2B 5fbb27d3b93352215576a032e048d97618b575c9788fc694c627e5334c6b19b2696caf4e578f4dd3ba0bccc98437765e81caecf83129a84d590a08f0ee082e09 SHA512 33d9d941d9007de7c6b3b9dec776fd38c09589aa390ed891862479b72128491197c40bc9d5802e2d8d2b22a06ea4e6ff5154c590468fb11fc1f5f1aa3e290f63
+EBUILD valgrind-9999.ebuild 4787 BLAKE2B 5fbb27d3b93352215576a032e048d97618b575c9788fc694c627e5334c6b19b2696caf4e578f4dd3ba0bccc98437765e81caecf83129a84d590a08f0ee082e09 SHA512 33d9d941d9007de7c6b3b9dec776fd38c09589aa390ed891862479b72128491197c40bc9d5802e2d8d2b22a06ea4e6ff5154c590468fb11fc1f5f1aa3e290f63
+MISC metadata.xml 1123 BLAKE2B 17b5501b05acd9384ab57a15018bc0d1ede50d7b5b9a5c38fcce816f68e8946010bc86233a197df89ad208957f90ab643942b7e1a3ceaa6e8d456320828b84e8 SHA512 a8c32063f3afd28c4a2d5c5c0f437c08772e822aaed4feb71f79e0f5a6cf81530d056bd8ae2ef73ac70792bd78fc095c069ef0d4304ff0a1c365f289d1191fe1
diff --git a/dev-debug/valgrind/files/valgrind-3.13.0-malloc.patch b/dev-debug/valgrind/files/valgrind-3.13.0-malloc.patch
new file mode 100644
index 000000000000..d0eb795b84be
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.13.0-malloc.patch
@@ -0,0 +1,24 @@
+--- valgrind-3.13.0/coregrind/m_replacemalloc/vg_replace_malloc.c
++++ valgrind-3.13.0/coregrind/m_replacemalloc/vg_replace_malloc.c
+@@ -765,13 +765,15 @@ static void init(void);
+ DO_INIT; \
+ MALLOC_TRACE("realloc(%p,%llu)", ptrV, (ULong)new_size ); \
+ \
+- if (ptrV == NULL) \
+- /* We need to call a malloc-like function; so let's use \
+- one which we know exists. */ \
+- return VG_REPLACE_FUNCTION_EZU(10010,VG_Z_LIBC_SONAME,malloc) \
+- (new_size); \
++ if (ptrV == NULL) { \
++ TRIGGER_MEMCHECK_ERROR_IF_UNDEFINED(new_size); \
++ v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_malloc, new_size ); \
++ MALLOC_TRACE(" = %p\n", v ); \
++ return v; \
++ } \
+ if (new_size <= 0) { \
+- VG_REPLACE_FUNCTION_EZU(10050,VG_Z_LIBC_SONAME,free)(ptrV); \
++ if (ptrV != NULL) \
++ VALGRIND_NON_SIMD_CALL1( info.tl_free, ptrV ); \
+ MALLOC_TRACE(" = 0\n"); \
+ return NULL; \
+ } \
diff --git a/dev-debug/valgrind/files/valgrind-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch b/dev-debug/valgrind/files/valgrind-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
new file mode 100644
index 000000000000..44176658df74
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
@@ -0,0 +1,22 @@
+From beab8d9f8d65230567270331017184c8762faa42 Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88@gmail.com>
+Date: Mon, 4 Nov 2019 09:12:16 -0800
+Subject: [PATCH] Build ldst_multiple test with -fno-pie
+
+Bug: https://bugs.gentoo.org/685070
+---
+ none/tests/ppc32/Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/none/tests/ppc32/Makefile.am b/none/tests/ppc32/Makefile.am
+index 11697c99a..222efd3f2 100644
+--- a/none/tests/ppc32/Makefile.am
++++ b/none/tests/ppc32/Makefile.am
+@@ -156,3 +156,4 @@ test_isa_2_07_part2_LDADD = -lm
+ test_tm_LDADD = -lm
+ test_touch_tm_LDADD = -lm
+
++ldst_multiple_CFLAGS = $(AM_CFLAGS) -fno-pie
+--
+2.23.0
+
diff --git a/dev-debug/valgrind/files/valgrind-3.20.0-gcc-13.patch b/dev-debug/valgrind/files/valgrind-3.20.0-gcc-13.patch
new file mode 100644
index 000000000000..3d3644f85fc1
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.20.0-gcc-13.patch
@@ -0,0 +1,44 @@
+https://sourceware.org/git/?p=valgrind.git;a=commit;h=dee222c6e818ca43ac45952fc8a020f445d98781
+https://sourceware.org/git/?p=valgrind.git;a=commit;h=3155bacf26237beb65edb4a572402492b2f1b050
+
+From dee222c6e818ca43ac45952fc8a020f445d98781 Mon Sep 17 00:00:00 2001
+From: Paul Floyd <pjfloyd@wanadoo.fr>
+Date: Fri, 27 Jan 2023 08:30:41 +0100
+Subject: [PATCH] Bug 464859 - Build failures with GCC-13 (drd tsan_unittest)
+
+Patch submitted by
+ Khem Raj <raj.khem@gmail.com>
+--- a/drd/tests/tsan_thread_wrappers_pthread.h
++++ b/drd/tests/tsan_thread_wrappers_pthread.h
+@@ -55,6 +55,7 @@
+ #define NO_TLS
+ #endif
+
++#include <cstdint>
+ #include <string>
+ using namespace std;
+
+--
+2.31.1
+
+From 3155bacf26237beb65edb4a572402492b2f1b050 Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <mark@klomp.org>
+Date: Sat, 28 Jan 2023 21:53:44 +0100
+Subject: [PATCH] tsan_thread_wrappers_pthread.h: Only include cstdint for
+ C++11
+
+Fixes build on older g++.
+--- a/drd/tests/tsan_thread_wrappers_pthread.h
++++ b/drd/tests/tsan_thread_wrappers_pthread.h
+@@ -55,7 +55,9 @@
+ #define NO_TLS
+ #endif
+
++#if __cplusplus >= 201103L
+ #include <cstdint>
++#endif
+ #include <string>
+ using namespace std;
+
+--
+2.31.1
diff --git a/dev-debug/valgrind/files/valgrind-3.20.0-musl-interpose.patch b/dev-debug/valgrind/files/valgrind-3.20.0-musl-interpose.patch
new file mode 100644
index 000000000000..6ede22f8b5ec
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.20.0-musl-interpose.patch
@@ -0,0 +1,30 @@
+https://bugs.kde.org/show_bug.cgi?id=435441
+
+From 460d0c9a6c27edfffed8ced623cecf64466619f2 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 4 Nov 2021 14:26:40 -0700
+Subject: [PATCH] Bug 435441 - Handle weak symbols as global for redirection
+
+Weak symbols are global but with lower precedence, so they should
+be handled the same way as global symbols during malloc replacement.
+
+This fixes valgrind on musl 1.2.2 when it is not patched with a
+soname (as is done on Alpine Linux).
+
+https://bugs.kde.org/show_bug.cgi?id=435441
+--- a/coregrind/m_debuginfo/readelf.c
++++ b/coregrind/m_debuginfo/readelf.c
+@@ -429,7 +429,8 @@ Bool get_elf_symbol_info (
+ }
+ # endif
+
+- if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL) {
++ if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL
++ || ELFXX_ST_BIND(sym->st_info) == STB_WEAK) {
+ *is_global_out = True;
+ }
+
+--
+2.32.0
+
+
diff --git a/dev-debug/valgrind/files/valgrind-3.20.0-tests-clang16.patch b/dev-debug/valgrind/files/valgrind-3.20.0-tests-clang16.patch
new file mode 100644
index 000000000000..01d51ba5f9ad
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.20.0-tests-clang16.patch
@@ -0,0 +1,23 @@
+https://bugs.kde.org/show_bug.cgi?id=462007
+https://sourceware.org/git/?p=valgrind.git;a=commit;h=0811a612dd7ce0c02a5dd699b34e660c742df8fe
+
+From 0811a612dd7ce0c02a5dd699b34e660c742df8fe Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <mark@klomp.org>
+Date: Fri, 18 Nov 2022 20:12:06 +0100
+Subject: [PATCH 1/1] Implicit int in none/tests/faultstatus.c
+
+There is a definition in faultstatus.c that is not accepted by
+C99 compilers (implicit ints were removed in that language revision).
+
+https://bugs.kde.org/show_bug.cgi?id=462007
+--- a/none/tests/faultstatus.c
++++ b/none/tests/faultstatus.c
+@@ -190,7 +190,7 @@ int main()
+ return 0;
+ }
+
+-static volatile s_zero;
++static volatile int s_zero;
+
+ static int zero()
+ {
diff --git a/dev-debug/valgrind/files/valgrind-3.21.0-glibc-2.34-suppressions.patch b/dev-debug/valgrind/files/valgrind-3.21.0-glibc-2.34-suppressions.patch
new file mode 100644
index 000000000000..c4111326cfa2
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.21.0-glibc-2.34-suppressions.patch
@@ -0,0 +1,197 @@
+commit e04914e10126d3a8de13302e958bbfd5e83a6637
+Author: Romain Geissler <romain.geissler@amadeus.com>
+Date: Mon Jan 30 16:09:47 2023 +0000
+
+ Fragile temporary fix for https://bugs.kde.org/show_bug.cgi?id=464671: avoid using @GLIBC_VERSION@ with our recent toolchains.
+
+ This is fragile as it might a bit too many things (especially ld*.so, which maybe shall be written "ld-linux-*.so" to be a bit more robust)
+ and also it doesn't work for glibc < 2.34.
+
+ Ideally something similar to GLIBC_LIBC_PATH shall be introduced for ld.so and libdl.so, so that
+ it covers both glibc < 2.34 and glibc >= 2.34.
+
+--- a/glibc-2.X.supp.in
++++ b/glibc-2.X.supp.in
+@@ -39,74 +39,74 @@
+ {
+ dl-hack3-cond-1
+ Memcheck:Cond
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
+ }
+ {
+ dl-hack3-cond-2
+ Memcheck:Cond
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/libc-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
++ obj:@GLIBC_LIBC_PATH@
+ }
+ {
+ dl-hack3-cond-3
+ Memcheck:Cond
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/libc-@GLIBC_VERSION@*.so*
+- obj:*/lib*/libc-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
+ }
+ {
+ dl-hack3-cond-4
+ Memcheck:Cond
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/libdl-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
++ obj:@GLIBC_LIBC_PATH@
+ }
+
+ {
+ dl-hack4-64bit-addr-1
+ Memcheck:Addr8
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
+ }
+ {
+ dl-hack4-64bit-addr-2
+ Memcheck:Addr8
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/libc-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
++ obj:@GLIBC_LIBC_PATH@
+ }
+ {
+ dl-hack4-64bit-addr-3
+ Memcheck:Addr8
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so*
+- obj:*/lib*/libdl-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so*
++ obj:*/lib*/ld*.so*
++ obj:@GLIBC_LIBC_PATH@
+ }
+
+ {
+ dl-hack5-32bit-addr-1
+ Memcheck:Addr4
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
++ obj:*/lib*/ld*.so
++ obj:*/lib*/ld*.so
++ obj:*/lib*/ld*.so
+ }
+ {
+ dl-hack5-32bit-addr-3
+ Memcheck:Addr4
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
+- obj:*/lib*/libdl-@GLIBC_VERSION@*.so*
++ obj:*/lib*/ld*.so
++ obj:*/lib*/ld*.so
++ obj:@GLIBC_LIBC_PATH@
+ }
+ {
+ dl-hack5-32bit-addr-4
+ Memcheck:Addr4
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
+- obj:*/lib*/libdl-@GLIBC_VERSION@*.so*
+- obj:*/lib*/ld-@GLIBC_VERSION@*.so
++ obj:*/lib*/ld*.so
++ obj:@GLIBC_LIBC_PATH@
++ obj:*/lib*/ld*.so
+ }
+
+
+@@ -124,7 +124,7 @@
+ glibc-2.5.x-on-SUSE-10.2-(PPC)-2a
+ Memcheck:Cond
+ fun:index
+- obj:*ld-@GLIBC_VERSION@.*.so
++ obj:*/lib*/ld*.so*
+ }
+ {
+ glibc-2.5.x-on-SuSE-10.2-(PPC)-2b
+@@ -136,7 +136,7 @@
+ glibc-2.5.5-on-SuSE-10.2-(PPC)-2c
+ Memcheck:Addr4
+ fun:index
+- obj:*ld-@GLIBC_VERSION@.*.so
++ obj:*/lib*/ld*.so*
+ }
+ {
+ glibc-2.3.5-on-SuSE-10.1-(PPC)-3
+@@ -149,9 +149,9 @@
+ {
+ glibc-@GLIBC_VERSION@-on-SUSE-10.3-(x86)
+ Memcheck:Addr4
+- obj:*/lib/ld-@GLIBC_VERSION@*.so
+- obj:*/lib/ld-@GLIBC_VERSION@*.so
+- obj:*/lib/ld-@GLIBC_VERSION@*.so
++ obj:*/lib/ld*.so
++ obj:*/lib/ld*.so
++ obj:*/lib/ld*.so
+ }
+
+ {
+@@ -168,9 +168,9 @@
+ Memcheck:Param
+ socketcall.sendto(msg)
+ fun:__sendto_nocancel
+- obj:/*libc-@GLIBC_VERSION@*.so
+- obj:/*libc-@GLIBC_VERSION@*.so
+- obj:/*libc-@GLIBC_VERSION@*.so
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
+ }
+ {
+ glibc24-64bit-padding-1c
+@@ -180,7 +180,7 @@
+ fun:__nscd_get_map_ref
+ fun:nscd_get*_r
+ fun:*nscd*
+- obj:/*libc-@GLIBC_VERSION@*.so
++ obj:@GLIBC_LIBC_PATH@
+ }
+
+
+@@ -199,18 +199,18 @@
+ Memcheck:Param
+ socketcall.sendto(msg)
+ fun:send
+- obj:/*libc-@GLIBC_VERSION@*.so
+- obj:/*libc-@GLIBC_VERSION@*.so
+- obj:/*libc-@GLIBC_VERSION@*.so
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
+ }
+ {
+ X11-64bit-padding-4b
+ Memcheck:Param
+ socketcall.send(msg)
+ fun:send
+- obj:/*libc-@GLIBC_VERSION@*.so
+- obj:/*libc-@GLIBC_VERSION@*.so
+- obj:/*libc-@GLIBC_VERSION@*.so
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
++ obj:@GLIBC_LIBC_PATH@
+ }
+
+ ##----------------------------------------------------------------------##
diff --git a/dev-debug/valgrind/files/valgrind-3.21.0-memcpy-fortify_source.patch b/dev-debug/valgrind/files/valgrind-3.21.0-memcpy-fortify_source.patch
new file mode 100644
index 000000000000..87acc9ff9f55
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.21.0-memcpy-fortify_source.patch
@@ -0,0 +1,26 @@
+Avoid false positives w/ overlapping memcpy args with _FORTIFY_SOURCE's
+memcpy_chk.
+
+https://src.fedoraproject.org/rpms/valgrind/raw/rawhide/f/valgrind-3.21.0-no-memcpy-replace-check.patch
+https://bugs.kde.org/show_bug.cgi?id=402833
+https://bugs.kde.org/show_bug.cgi?id=453084
+--- a/shared/vg_replace_strmem.c
++++ b/shared/vg_replace_strmem.c
+@@ -1128,7 +1128,7 @@ static inline void my_exit ( int x )
+ MEMMOVE_OR_MEMCPY(20181, soname, fnname, 0)
+
+ #define MEMCPY(soname, fnname) \
+- MEMMOVE_OR_MEMCPY(20180, soname, fnname, 1)
++ MEMMOVE_OR_MEMCPY(20180, soname, fnname, 0) /* See KDE bug #402833 */
+
+ #if defined(VGO_linux)
+ /* For older memcpy we have to use memmove-like semantics and skip
+@@ -1714,8 +1714,6 @@ static inline void my_exit ( int x )
+ RECORD_COPY(len); \
+ if (len == 0) \
+ return dst; \
+- if (is_overlap(dst, src, len, len)) \
+- RECORD_OVERLAP_ERROR("memcpy_chk", dst, src, len); \
+ if ( dst > src ) { \
+ d = (HChar *)dst + len - 1; \
+ s = (const HChar *)src + len - 1; \
diff --git a/dev-debug/valgrind/files/valgrind-3.7.0-respect-flags.patch b/dev-debug/valgrind/files/valgrind-3.7.0-respect-flags.patch
new file mode 100644
index 000000000000..860e09c86ed3
--- /dev/null
+++ b/dev-debug/valgrind/files/valgrind-3.7.0-respect-flags.patch
@@ -0,0 +1,13 @@
+diff -Naur valgrind-3.7.0.orig//mpi/Makefile.am valgrind-3.7.0/mpi/Makefile.am
+--- valgrind-3.7.0.orig//mpi/Makefile.am 2011-10-26 17:24:23.000000000 -0400
++++ valgrind-3.7.0/mpi/Makefile.am 2011-11-10 16:03:14.000000000 -0500
+@@ -7,9 +7,6 @@
+ CC = $(MPI_CC)
+ DEFS =
+ DEFAULT_INCLUDES =
+-CPPFLAGS =
+-CFLAGS =
+-LDFLAGS =
+
+ EXTRA_DIST = \
+ mpiwrap_type_test.c
diff --git a/dev-debug/valgrind/metadata.xml b/dev-debug/valgrind/metadata.xml
new file mode 100644
index 000000000000..e8e4b8fe98e0
--- /dev/null
+++ b/dev-debug/valgrind/metadata.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>toolchain@gentoo.org</email>
+ <name>Gentoo Toolchain Project</name>
+ </maintainer>
+ <longdescription>
+ Valgrind is a GPL'd tool to help you find memory-management problems
+ in your programs. When a program is run under Valgrind's supervision,
+ all reads and writes of memory are checked, and calls to
+ malloc/new/free/delete are intercepted. As a result, Valgrind can
+ detect problems such as
+
+ - Use of uninitialised memory
+ - Reading/writing memory after it has been free'd
+ - Reading/writing off the end of malloc'd blocks
+ - Reading/writing inappropriate areas on the stack
+ - Memory leaks -- where pointers to malloc'd blocks are lost forever
+ - Passing of uninitialised and/or unaddressible memory to system calls
+ - Mismatched use of malloc/new/new [] vs free/delete/delete []
+ - Some abuses of the POSIX Pthreads API
+ </longdescription>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:valgrind:valgrind</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-debug/valgrind/valgrind-3.20.0-r2.ebuild b/dev-debug/valgrind/valgrind-3.20.0-r2.ebuild
new file mode 100644
index 000000000000..deaf0eaa8edd
--- /dev/null
+++ b/dev-debug/valgrind/valgrind-3.20.0-r2.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic toolchain-funcs multilib pax-utils
+
+DESCRIPTION="An open-source memory debugger for GNU/Linux"
+HOMEPAGE="https://valgrind.org"
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://sourceware.org/git/${PN}.git"
+ inherit git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/valgrind.gpg
+ inherit verify-sig
+ SRC_URI="https://sourceware.org/pub/valgrind/${P}.tar.bz2"
+ SRC_URI+=" verify-sig? ( https://sourceware.org/pub/valgrind/${P}.tar.bz2.asc )"
+ KEYWORDS="-* amd64 arm arm64 ppc ppc64 x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="mpi"
+
+DEPEND="mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+if [[ ${PV} != 9999 ]] ; then
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-valgrind )"
+fi
+
+PATCHES=(
+ # Respect CFLAGS, LDFLAGS
+ "${FILESDIR}"/${PN}-3.7.0-respect-flags.patch
+ "${FILESDIR}"/${PN}-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
+ "${FILESDIR}"/${P}-tests-clang16.patch
+ "${FILESDIR}"/${P}-gcc-13.patch
+)
+
+src_prepare() {
+ # Correct hard coded doc location
+ sed -i -e "s:doc/valgrind:doc/${PF}:" docs/Makefile.am || die
+
+ # Don't force multiarch stuff on OSX, bug #306467
+ sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
+
+ if use elibc_musl ; then
+ PATCHES+=(
+ "${FILESDIR}"/${PN}-3.13.0-malloc.patch
+ "${FILESDIR}"/${PN}-3.20.0-musl-interpose.patch
+ )
+ fi
+
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # upstream doesn't support this, but we don't build with
+ # Sun/Oracle ld, we have a GNU toolchain, so get some things
+ # working the Linux/GNU way
+ find "${S}" -name "Makefile.am" -o -name "Makefile.tool.am" | xargs \
+ sed -i -e 's:-M,/usr/lib/ld/map.noexstk:-z,noexecstack:' || die
+ cp "${S}"/coregrind/link_tool_exe_{linux,solaris}.in
+ fi
+
+ default
+
+ # Regenerate autotools files
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=()
+
+ # Respect ar, bug #468114
+ tc-export AR
+
+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
+ # while compiling insn_sse.c in none/tests/x86
+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
+ # because valgrind doesn't link to glibc (bug #114347)
+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
+ # -fstack-protector-strong See -fstack-protector (bug #620402)
+ # -m64 -mx32 for multilib-portage, bug #398825
+ # -ggdb3 segmentation fault on startup
+ # -flto* fails to build, bug #858509
+ filter-flags -fomit-frame-pointer
+ filter-flags -fstack-protector
+ filter-flags -fstack-protector-all
+ filter-flags -fstack-protector-strong
+ filter-flags -m64 -mx32
+ filter-flags -fsanitize -fsanitize=*
+ replace-flags -ggdb3 -ggdb2
+ filter-lto
+
+ if use amd64 || use ppc64; then
+ ! has_multilib_profile && myconf+=("--enable-only64bit")
+ fi
+
+ # Force bitness on darwin, bug #306467
+ use x64-macos && myconf+=("--enable-only64bit")
+
+ # Don't use mpicc unless the user asked for it (bug #258832)
+ if ! use mpi; then
+ myconf+=("--without-mpicc")
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ # Otherwise FAQ.txt won't exist:
+ emake -C docs FAQ.txt
+ mv docs/FAQ.txt . || die "Couldn't move FAQ.txt"
+ fi
+
+ dodoc FAQ.txt
+
+ pax-mark m "${ED}"/usr/$(get_libdir)/valgrind/*-*-linux
+
+ # See README_PACKAGERS
+ dostrip -x /usr/libexec/valgrind/vgpreload* /usr/$(get_libdir)/valgrind/*
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fix install_names on shared libraries, can't turn them into bundles,
+ # as dyld won't load them any more then, bug #306467
+ local l
+ for l in "${ED}"/usr/lib/valgrind/*.so ; do
+ install_name_tool -id "${EPREFIX}"/usr/lib/valgrind/${l##*/} "${l}"
+ done
+ fi
+}
+
+pkg_postinst() {
+ elog "Valgrind will not work if libc (e.g. glibc) does not have debug symbols."
+ elog "To fix this you can add splitdebug to FEATURES in make.conf"
+ elog "and remerge glibc. See:"
+ elog "https://bugs.gentoo.org/214065"
+ elog "https://bugs.gentoo.org/274771"
+ elog "https://bugs.gentoo.org/388703"
+}
diff --git a/dev-debug/valgrind/valgrind-3.21.0-r1.ebuild b/dev-debug/valgrind/valgrind-3.21.0-r1.ebuild
new file mode 100644
index 000000000000..9b78aebad2fb
--- /dev/null
+++ b/dev-debug/valgrind/valgrind-3.21.0-r1.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic toolchain-funcs multilib pax-utils
+
+DESCRIPTION="An open-source memory debugger for GNU/Linux"
+HOMEPAGE="https://valgrind.org"
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://sourceware.org/git/${PN}.git"
+ inherit git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/valgrind.gpg
+ inherit verify-sig
+ SRC_URI="https://sourceware.org/pub/valgrind/${P}.tar.bz2"
+ SRC_URI+=" verify-sig? ( https://sourceware.org/pub/valgrind/${P}.tar.bz2.asc )"
+ KEYWORDS="-* amd64 ~arm arm64 ~ppc ppc64 x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="mpi"
+
+DEPEND="mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+if [[ ${PV} != 9999 ]] ; then
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-valgrind )"
+fi
+
+PATCHES=(
+ # Respect CFLAGS, LDFLAGS
+ "${FILESDIR}"/${PN}-3.7.0-respect-flags.patch
+ "${FILESDIR}"/${PN}-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
+)
+
+src_prepare() {
+ # Correct hard coded doc location
+ sed -i -e "s:doc/valgrind:doc/${PF}:" docs/Makefile.am || die
+
+ # Don't force multiarch stuff on OSX, bug #306467
+ sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
+
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # upstream doesn't support this, but we don't build with
+ # Sun/Oracle ld, we have a GNU toolchain, so get some things
+ # working the Linux/GNU way
+ find "${S}" -name "Makefile.am" -o -name "Makefile.tool.am" | xargs \
+ sed -i -e 's:-M,/usr/lib/ld/map.noexstk:-z,noexecstack:' || die
+ cp "${S}"/coregrind/link_tool_exe_{linux,solaris}.in
+ fi
+
+ default
+
+ # Regenerate autotools files
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=()
+
+ # Respect ar, bug #468114
+ tc-export AR
+
+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
+ # while compiling insn_sse.c in none/tests/x86
+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
+ # because valgrind doesn't link to glibc (bug #114347)
+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
+ # -fstack-protector-strong See -fstack-protector (bug #620402)
+ # -m64 -mx32 for multilib-portage, bug #398825
+ # -ggdb3 segmentation fault on startup
+ # -flto* fails to build, bug #858509
+ filter-flags -fomit-frame-pointer
+ filter-flags -fstack-protector
+ filter-flags -fstack-protector-all
+ filter-flags -fstack-protector-strong
+ filter-flags -m64 -mx32
+ filter-flags -fsanitize -fsanitize=*
+ replace-flags -ggdb3 -ggdb2
+ filter-lto
+
+ if use amd64 || use ppc64; then
+ ! has_multilib_profile && myconf+=("--enable-only64bit")
+ fi
+
+ # Force bitness on darwin, bug #306467
+ use x64-macos && myconf+=("--enable-only64bit")
+
+ # Don't use mpicc unless the user asked for it (bug #258832)
+ if ! use mpi; then
+ myconf+=("--without-mpicc")
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ # Otherwise FAQ.txt won't exist:
+ emake -C docs FAQ.txt
+ mv docs/FAQ.txt . || die "Couldn't move FAQ.txt"
+ fi
+
+ dodoc FAQ.txt
+
+ pax-mark m "${ED}"/usr/$(get_libdir)/valgrind/*-*-linux
+
+ # See README_PACKAGERS
+ dostrip -x /usr/libexec/valgrind/vgpreload* /usr/$(get_libdir)/valgrind/*
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fix install_names on shared libraries, can't turn them into bundles,
+ # as dyld won't load them any more then, bug #306467
+ local l
+ for l in "${ED}"/usr/lib/valgrind/*.so ; do
+ install_name_tool -id "${EPREFIX}"/usr/lib/valgrind/${l##*/} "${l}"
+ done
+ fi
+}
+
+pkg_postinst() {
+ elog "Valgrind will not work if libc (e.g. glibc) does not have debug symbols."
+ elog "To fix this you can add splitdebug to FEATURES in make.conf"
+ elog "and remerge glibc. See:"
+ elog "https://bugs.gentoo.org/214065"
+ elog "https://bugs.gentoo.org/274771"
+ elog "https://bugs.gentoo.org/388703"
+}
diff --git a/dev-debug/valgrind/valgrind-3.21.0-r2.ebuild b/dev-debug/valgrind/valgrind-3.21.0-r2.ebuild
new file mode 100644
index 000000000000..1c6ad6cb0422
--- /dev/null
+++ b/dev-debug/valgrind/valgrind-3.21.0-r2.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# The Valgrind upstream maintainer also maintains it in Fedora and will
+# backport fixes there which haven't yet made it into a release. Keep an eye
+# on it for fixes we should cherry-pick too:
+# https://src.fedoraproject.org/rpms/valgrind/tree/rawhide
+
+inherit autotools flag-o-matic toolchain-funcs multilib pax-utils
+
+DESCRIPTION="An open-source memory debugger for GNU/Linux"
+HOMEPAGE="https://valgrind.org"
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://sourceware.org/git/${PN}.git"
+ inherit git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/valgrind.gpg
+ inherit verify-sig
+ SRC_URI="https://sourceware.org/pub/valgrind/${P}.tar.bz2"
+ SRC_URI+=" verify-sig? ( https://sourceware.org/pub/valgrind/${P}.tar.bz2.asc )"
+ KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="mpi"
+
+DEPEND="mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+if [[ ${PV} != 9999 ]] ; then
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-valgrind )"
+fi
+
+PATCHES=(
+ # Respect CFLAGS, LDFLAGS
+ "${FILESDIR}"/${PN}-3.7.0-respect-flags.patch
+ "${FILESDIR}"/${PN}-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
+ "${FILESDIR}"/${PN}-3.21.0-glibc-2.34-suppressions.patch
+ "${FILESDIR}"/${PN}-3.21.0-memcpy-fortify_source.patch
+)
+
+src_prepare() {
+ # Correct hard coded doc location
+ sed -i -e "s:doc/valgrind:doc/${PF}:" docs/Makefile.am || die
+
+ # Don't force multiarch stuff on OSX, bug #306467
+ sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
+
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # upstream doesn't support this, but we don't build with
+ # Sun/Oracle ld, we have a GNU toolchain, so get some things
+ # working the Linux/GNU way
+ find "${S}" -name "Makefile.am" -o -name "Makefile.tool.am" | xargs \
+ sed -i -e 's:-M,/usr/lib/ld/map.noexstk:-z,noexecstack:' || die
+ cp "${S}"/coregrind/link_tool_exe_{linux,solaris}.in
+ fi
+
+ default
+
+ # Regenerate autotools files
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=()
+
+ # Respect ar, bug #468114
+ tc-export AR
+
+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
+ # while compiling insn_sse.c in none/tests/x86
+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
+ # because valgrind doesn't link to glibc (bug #114347)
+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
+ # -fstack-protector-strong See -fstack-protector (bug #620402)
+ # -m64 -mx32 for multilib-portage, bug #398825
+ # -ggdb3 segmentation fault on startup
+ # -flto* fails to build, bug #858509
+ filter-flags -fomit-frame-pointer
+ filter-flags -fstack-protector
+ filter-flags -fstack-protector-all
+ filter-flags -fstack-protector-strong
+ filter-flags -m64 -mx32
+ filter-flags -fsanitize -fsanitize=*
+ replace-flags -ggdb3 -ggdb2
+ filter-lto
+
+ if use amd64 || use ppc64; then
+ ! has_multilib_profile && myconf+=("--enable-only64bit")
+ fi
+
+ # Force bitness on darwin, bug #306467
+ use x64-macos && myconf+=("--enable-only64bit")
+
+ # Don't use mpicc unless the user asked for it (bug #258832)
+ if ! use mpi; then
+ myconf+=("--without-mpicc")
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_install() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ # Otherwise FAQ.txt won't exist:
+ emake -C docs FAQ.txt
+ mv docs/FAQ.txt . || die "Couldn't move FAQ.txt"
+ fi
+
+ dodoc FAQ.txt
+
+ pax-mark m "${ED}"/usr/$(get_libdir)/valgrind/*-*-linux
+
+ # See README_PACKAGERS
+ dostrip -x /usr/libexec/valgrind/vgpreload* /usr/$(get_libdir)/valgrind/*
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fix install_names on shared libraries, can't turn them into bundles,
+ # as dyld won't load them any more then, bug #306467
+ local l
+ for l in "${ED}"/usr/lib/valgrind/*.so ; do
+ install_name_tool -id "${EPREFIX}"/usr/lib/valgrind/${l##*/} "${l}"
+ done
+ fi
+}
+
+pkg_postinst() {
+ elog "Valgrind will not work if libc (e.g. glibc) does not have debug symbols."
+ elog "To fix this you can add splitdebug to FEATURES in make.conf"
+ elog "and remerge glibc. See:"
+ elog "https://bugs.gentoo.org/214065"
+ elog "https://bugs.gentoo.org/274771"
+ elog "https://bugs.gentoo.org/388703"
+}
diff --git a/dev-debug/valgrind/valgrind-3.22.0.ebuild b/dev-debug/valgrind/valgrind-3.22.0.ebuild
new file mode 100644
index 000000000000..3d0c31f598dc
--- /dev/null
+++ b/dev-debug/valgrind/valgrind-3.22.0.ebuild
@@ -0,0 +1,152 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# The Valgrind upstream maintainer also maintains it in Fedora and will
+# backport fixes there which haven't yet made it into a release. Keep an eye
+# on it for fixes we should cherry-pick too:
+# https://src.fedoraproject.org/rpms/valgrind/tree/rawhide
+
+inherit autotools flag-o-matic toolchain-funcs multilib pax-utils
+
+DESCRIPTION="An open-source memory debugger for GNU/Linux"
+HOMEPAGE="https://valgrind.org"
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://sourceware.org/git/${PN}.git"
+ inherit git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/valgrind.gpg
+ inherit verify-sig
+
+ MY_P="${P/_rc/.RC}"
+ SRC_URI="https://sourceware.org/pub/valgrind/${MY_P}.tar.bz2"
+ SRC_URI+=" verify-sig? ( https://sourceware.org/pub/valgrind/${MY_P}.tar.bz2.asc )"
+ S="${WORKDIR}"/${MY_P}
+
+ if [[ ${PV} != *_rc* ]] ; then
+ KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+ fi
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="mpi"
+
+DEPEND="mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+if [[ ${PV} != 9999 ]] ; then
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-valgrind )"
+fi
+
+PATCHES=(
+ # Respect CFLAGS, LDFLAGS
+ "${FILESDIR}"/${PN}-3.7.0-respect-flags.patch
+ "${FILESDIR}"/${PN}-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
+ "${FILESDIR}"/${PN}-3.21.0-glibc-2.34-suppressions.patch
+)
+
+src_prepare() {
+ # Correct hard coded doc location
+ sed -i -e "s:doc/valgrind:doc/${PF}:" docs/Makefile.am || die
+
+ # Don't force multiarch stuff on OSX, bug #306467
+ sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
+
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # upstream doesn't support this, but we don't build with
+ # Sun/Oracle ld, we have a GNU toolchain, so get some things
+ # working the Linux/GNU way
+ find "${S}" -name "Makefile.am" -o -name "Makefile.tool.am" | xargs \
+ sed -i -e 's:-M,/usr/lib/ld/map.noexstk:-z,noexecstack:' || die
+ cp "${S}"/coregrind/link_tool_exe_{linux,solaris}.in
+ fi
+
+ default
+
+ # Regenerate autotools files
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=(
+ --with-gdbscripts-dir="${EPREFIX}"/usr/share/gdb/auto-load
+ )
+
+ # Respect ar, bug #468114
+ tc-export AR
+
+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
+ # while compiling insn_sse.c in none/tests/x86
+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
+ # because valgrind doesn't link to glibc (bug #114347)
+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
+ # -fstack-protector-strong See -fstack-protector (bug #620402)
+ # -m64 -mx32 for multilib-portage, bug #398825
+ # -fharden-control-flow-redundancy: breaks runtime ('jump to the invalid address stated on the next line')
+ # -flto* fails to build, bug #858509
+ filter-flags -fomit-frame-pointer
+ filter-flags -fstack-protector
+ filter-flags -fstack-protector-all
+ filter-flags -fstack-protector-strong
+ filter-flags -m64 -mx32
+ filter-flags -fsanitize -fsanitize=*
+ filter-flags -fharden-control-flow-redundancy
+ append-cflags $(test-flags-CC -fno-harden-control-flow-redundancy)
+ filter-lto
+
+ if use amd64 || use ppc64; then
+ ! has_multilib_profile && myconf+=("--enable-only64bit")
+ fi
+
+ # Force bitness on darwin, bug #306467
+ use x64-macos && myconf+=("--enable-only64bit")
+
+ # Don't use mpicc unless the user asked for it (bug #258832)
+ if ! use mpi; then
+ myconf+=("--without-mpicc")
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ # fxsave.o, tronical.o have textrels
+ emake LDFLAGS="${LDFLAGS} -Wl,-z,notext" check
+}
+
+src_install() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ # Otherwise FAQ.txt won't exist:
+ emake -C docs FAQ.txt
+ mv docs/FAQ.txt . || die "Couldn't move FAQ.txt"
+ fi
+
+ dodoc FAQ.txt
+
+ pax-mark m "${ED}"/usr/$(get_libdir)/valgrind/*-*-linux
+
+ # See README_PACKAGERS
+ dostrip -x /usr/libexec/valgrind/vgpreload* /usr/$(get_libdir)/valgrind/*
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fix install_names on shared libraries, can't turn them into bundles,
+ # as dyld won't load them any more then, bug #306467
+ local l
+ for l in "${ED}"/usr/lib/valgrind/*.so ; do
+ install_name_tool -id "${EPREFIX}"/usr/lib/valgrind/${l##*/} "${l}"
+ done
+ fi
+}
+
+pkg_postinst() {
+ elog "Valgrind will not work if libc (e.g. glibc) does not have debug symbols."
+ elog "To fix this you can add splitdebug to FEATURES in make.conf"
+ elog "and remerge glibc. See:"
+ elog "https://bugs.gentoo.org/214065"
+ elog "https://bugs.gentoo.org/274771"
+ elog "https://bugs.gentoo.org/388703"
+}
diff --git a/dev-debug/valgrind/valgrind-9999.ebuild b/dev-debug/valgrind/valgrind-9999.ebuild
new file mode 100644
index 000000000000..3d0c31f598dc
--- /dev/null
+++ b/dev-debug/valgrind/valgrind-9999.ebuild
@@ -0,0 +1,152 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# The Valgrind upstream maintainer also maintains it in Fedora and will
+# backport fixes there which haven't yet made it into a release. Keep an eye
+# on it for fixes we should cherry-pick too:
+# https://src.fedoraproject.org/rpms/valgrind/tree/rawhide
+
+inherit autotools flag-o-matic toolchain-funcs multilib pax-utils
+
+DESCRIPTION="An open-source memory debugger for GNU/Linux"
+HOMEPAGE="https://valgrind.org"
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://sourceware.org/git/${PN}.git"
+ inherit git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/valgrind.gpg
+ inherit verify-sig
+
+ MY_P="${P/_rc/.RC}"
+ SRC_URI="https://sourceware.org/pub/valgrind/${MY_P}.tar.bz2"
+ SRC_URI+=" verify-sig? ( https://sourceware.org/pub/valgrind/${MY_P}.tar.bz2.asc )"
+ S="${WORKDIR}"/${MY_P}
+
+ if [[ ${PV} != *_rc* ]] ; then
+ KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+ fi
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="mpi"
+
+DEPEND="mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+if [[ ${PV} != 9999 ]] ; then
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-valgrind )"
+fi
+
+PATCHES=(
+ # Respect CFLAGS, LDFLAGS
+ "${FILESDIR}"/${PN}-3.7.0-respect-flags.patch
+ "${FILESDIR}"/${PN}-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch
+ "${FILESDIR}"/${PN}-3.21.0-glibc-2.34-suppressions.patch
+)
+
+src_prepare() {
+ # Correct hard coded doc location
+ sed -i -e "s:doc/valgrind:doc/${PF}:" docs/Makefile.am || die
+
+ # Don't force multiarch stuff on OSX, bug #306467
+ sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
+
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # upstream doesn't support this, but we don't build with
+ # Sun/Oracle ld, we have a GNU toolchain, so get some things
+ # working the Linux/GNU way
+ find "${S}" -name "Makefile.am" -o -name "Makefile.tool.am" | xargs \
+ sed -i -e 's:-M,/usr/lib/ld/map.noexstk:-z,noexecstack:' || die
+ cp "${S}"/coregrind/link_tool_exe_{linux,solaris}.in
+ fi
+
+ default
+
+ # Regenerate autotools files
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=(
+ --with-gdbscripts-dir="${EPREFIX}"/usr/share/gdb/auto-load
+ )
+
+ # Respect ar, bug #468114
+ tc-export AR
+
+ # -fomit-frame-pointer "Assembler messages: Error: junk `8' after expression"
+ # while compiling insn_sse.c in none/tests/x86
+ # -fstack-protector more undefined references to __guard and __stack_smash_handler
+ # because valgrind doesn't link to glibc (bug #114347)
+ # -fstack-protector-all Fails same way as -fstack-protector/-fstack-protector-strong.
+ # Note: -fstack-protector-explicit is a no-op for Valgrind, no need to strip it
+ # -fstack-protector-strong See -fstack-protector (bug #620402)
+ # -m64 -mx32 for multilib-portage, bug #398825
+ # -fharden-control-flow-redundancy: breaks runtime ('jump to the invalid address stated on the next line')
+ # -flto* fails to build, bug #858509
+ filter-flags -fomit-frame-pointer
+ filter-flags -fstack-protector
+ filter-flags -fstack-protector-all
+ filter-flags -fstack-protector-strong
+ filter-flags -m64 -mx32
+ filter-flags -fsanitize -fsanitize=*
+ filter-flags -fharden-control-flow-redundancy
+ append-cflags $(test-flags-CC -fno-harden-control-flow-redundancy)
+ filter-lto
+
+ if use amd64 || use ppc64; then
+ ! has_multilib_profile && myconf+=("--enable-only64bit")
+ fi
+
+ # Force bitness on darwin, bug #306467
+ use x64-macos && myconf+=("--enable-only64bit")
+
+ # Don't use mpicc unless the user asked for it (bug #258832)
+ if ! use mpi; then
+ myconf+=("--without-mpicc")
+ fi
+
+ econf "${myconf[@]}"
+}
+
+src_test() {
+ # fxsave.o, tronical.o have textrels
+ emake LDFLAGS="${LDFLAGS} -Wl,-z,notext" check
+}
+
+src_install() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ # Otherwise FAQ.txt won't exist:
+ emake -C docs FAQ.txt
+ mv docs/FAQ.txt . || die "Couldn't move FAQ.txt"
+ fi
+
+ dodoc FAQ.txt
+
+ pax-mark m "${ED}"/usr/$(get_libdir)/valgrind/*-*-linux
+
+ # See README_PACKAGERS
+ dostrip -x /usr/libexec/valgrind/vgpreload* /usr/$(get_libdir)/valgrind/*
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ # fix install_names on shared libraries, can't turn them into bundles,
+ # as dyld won't load them any more then, bug #306467
+ local l
+ for l in "${ED}"/usr/lib/valgrind/*.so ; do
+ install_name_tool -id "${EPREFIX}"/usr/lib/valgrind/${l##*/} "${l}"
+ done
+ fi
+}
+
+pkg_postinst() {
+ elog "Valgrind will not work if libc (e.g. glibc) does not have debug symbols."
+ elog "To fix this you can add splitdebug to FEATURES in make.conf"
+ elog "and remerge glibc. See:"
+ elog "https://bugs.gentoo.org/214065"
+ elog "https://bugs.gentoo.org/274771"
+ elog "https://bugs.gentoo.org/388703"
+}