Subject: [PATCH 1/1] gnu: glibc: Preserve "__pthread_key_create" symbol.

From: Simon South <[email-masked]>
Date: Mon, 10 Jan 2022 18:34:26 -0500

Avoid a potential crash in multithreaded applications by preserving the
pthread library's "__pthread_key_create" symbol, used by libgcc to detect the
use of threads in an application.

Fixes <https://issues.guix.gnu.org/53005>.

* gnu/packages/base.scm (glibc)[arguments]: Add "#:strip-flags" with
"--keep-symbol=__pthread_key_create" appended to the default set.
---
 gnu/packages/base.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 12e4de52d4..68c85dcdd5 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -795,6 +795,16 @@ (define-public glibc
                   '()))
 
       #:tests? #f                                 ; XXX
+
+      #:strip-flags '("--strip-unneeded"
+                      "--enable-deterministic-archives"
+
+                      ;; Preserve the symbol "__pthread_key_create" in the
+                      ;; pthread library as this is used by libgcc to detect
+                      ;; the use of threads in an application.
+                      ;; See https://issues.guix.gnu.org/53005.
+                      "--keep-symbol=__pthread_key_create")
+
       #:phases (modify-phases %standard-phases
                  (add-before
                   'configure 'pre-configure
-- 
2.34.0