diff mbox series

[bug#54832] update glibc to 2.35

Message ID 1143838129.1375777.1658239971665@privateemail.com
State Accepted
Headers show
Series [bug#54832] update glibc to 2.35 | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

zamfofex July 19, 2022, 2:12 p.m. UTC
> There’s a comment at the top of ‘glibc-dl-cache.patch’ that explains
> what it does, but see
> <https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/>
> for details.  I can take a look and update it.

It seems we both misinterpreted the diff I had sent originally, as that patch has not actually been removed, but rather its line was changed (it was moved upwards). So good news, no need for changes or further investigation!

> We’d need a comment like “Keep empty .a files in OUT in addition to
> STATIC because …”.

I added a comment explaining the change! I hope it is enough.

> [conversation about M4 changes]

Apparently M4 has already been updated in core-updates by now! So that all of that has already been resolved.

> Perfect.  I realize upgrading glibc is a rather tricky task, so thanks
> for giving it a try!  Surely we can team up to get it past the finish
> line.

Thanks for the encouragement! However, since glibc 2.36 releases a few weeks from now, do you feel like it would make sense to wait until then to update it? I suppose it could always be updated again later, but I don’t know if that’s ideal.

- - -

Also, I could not figure out how to use ‘git prepare-patch’ or ‘git send-email’ properly, so I hope a ‘git diff’ attachment is enough.

Comments

Greg Hogan July 19, 2022, 7:16 p.m. UTC | #1
On Tue, Jul 19, 2022 at 12:14 PM zamfofex <zamfofex@twdb.moe> wrote:
>
> > There’s a comment at the top of ‘glibc-dl-cache.patch’ that explains
> > what it does, but see
> > <https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/>
> > for details.  I can take a look and update it.
>
> It seems we both misinterpreted the diff I had sent originally, as that patch has not actually been removed, but rather its line was changed (it was moved upwards). So good news, no need for changes or further investigation!

I have used your patch to bootstrap with GCC 12 (in order to use both
gcc-12 and llvm-14 in the same profile) and I have found that without
"glibc-ldd-x86_64.patch", sometimes ldd will throw a "not a dynamic
executable" error. I assume the powerpc patch is likewise still
required.

> Thanks for the encouragement! However, since glibc 2.36 releases a few weeks from now, do you feel like it would make sense to wait until then to update it? I suppose it could always be updated again later, but I don’t know if that’s ideal.

I would like to see the 2.35 upgrade since others may benefit before
the 2.36 release and in case of a core-updates merge to master.

Greg
Marius Bakke Sept. 1, 2022, 10:32 p.m. UTC | #2
Greg Hogan <code@greghogan.com> skriver:

> On Tue, Jul 19, 2022 at 12:14 PM zamfofex <zamfofex@twdb.moe> wrote:
>>
>> > There’s a comment at the top of ‘glibc-dl-cache.patch’ that explains
>> > what it does, but see
>> > <https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/>
>> > for details.  I can take a look and update it.
>>
>> It seems we both misinterpreted the diff I had sent originally, as that patch has not actually been removed, but rather its line was changed (it was moved upwards). So good news, no need for changes or further investigation!
>
> I have used your patch to bootstrap with GCC 12 (in order to use both
> gcc-12 and llvm-14 in the same profile) and I have found that without
> "glibc-ldd-x86_64.patch", sometimes ldd will throw a "not a dynamic
> executable" error. I assume the powerpc patch is likewise still
> required.

I submitted a variant of this patch to #57533 that preserves
glibc-ldd-x86_64.patch.

Closing this issue, as it has been superseded by #57533.

Thanks zamfofex!
diff mbox series

Patch

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index cf640aa..0cd5d61 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -20,6 +20,7 @@ 
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 zamfofex <zamfofex@twdb.moe>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -709,16 +710,14 @@  (define-public glibc
   ;; version 2.28, GNU/Hurd used a different glibc branch.
   (package
    (name "glibc")
-   (version "2.33")
+   (version "2.35")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
             (sha256
              (base32
-              "1zvp0qdfbdyqrzydz18d9zg3n5ygy8ps7cmny1bvsp8h1q05c99f"))
-            (patches (search-patches "glibc-ldd-powerpc.patch"
-                                     "glibc-ldd-x86_64.patch"
-                                     "glibc-dl-cache.patch"
+              "0bpm1kfi09dxl4c6aanc5c9951fmf6ckkzay60cx7k37dcpp68si"))
+            (patches (search-patches "glibc-dl-cache.patch"
                                      "glibc-versioned-locpath.patch"
                                      "glibc-allow-kernel-2.6.32.patch"
                                      "glibc-reinstate-prlimit64-fallback.patch"
@@ -753,6 +752,7 @@  (define-public glibc
       #:validate-runpath? #f
 
       #:modules ((ice-9 ftw)
+                 (srfi srfi-1)
                  (srfi srfi-26)
                  (guix build utils)
                  (guix build gnu-build-system))
@@ -867,13 +867,34 @@  (define-public glibc
                  (add-after 'install 'move-static-libs
                    (lambda* (#:key outputs #:allow-other-keys)
                      ;; Move static libraries to the "static" output.
+                     ;; Note: As of GNU libc 2.34, the contents of some ".a"
+                     ;; files have been moved into "libc.so", and *both* empty
+                     ;; ".so" and ".a" files have been introduced to avoid
+                     ;; breaking existing executables and existing builds
+                     ;; respectively.  The intent of the seemingly redundant
+                     ;; empty ".a" files is to avoid newly-compiled executables
+                     ;; from having dependencies on the empty shared libraries,
+                     ;; and as such, it is useful to have these ".a" files in
+                     ;; OUT in addition to STATIC.
+
+                     ;; XXX: It might be better to determine whether a static
+                     ;; library is empty by some criterion (such as their file
+                     ;; size equaling eight bytes) rather than hardcoding them
+                     ;; by name.
+                     (define empty-static-libraries
+                       '("libpthread.a" "libdl.a" "libutil.a" "libanl.a"))
+                     (define (empty-static-library? file)
+                       (any (lambda (s)
+                              (string=? file s)) empty-static-libraries))
+
                      (define (static-library? file)
                        ;; Return true if FILE is a static library.  The
                        ;; "_nonshared.a" files are referred to by libc.so,
                        ;; libpthread.so, etc., which are in fact linker
                        ;; scripts.
                        (and (string-suffix? ".a" file)
-                            (not (string-contains file "_nonshared"))))
+                            (not (string-contains file "_nonshared"))
+                            (not (empty-static-library? file))))
 
                      (define (linker-script? file)
                        ;; Guess whether FILE, a ".a" file, is actually a
@@ -884,6 +905,7 @@  (define (linker-script? file)
                      (let* ((out    (assoc-ref outputs "out"))
                             (lib    (string-append out "/lib"))
                             (files  (scandir lib static-library?))
+                            (files2 (scandir lib empty-static-library?))
                             (static (assoc-ref outputs "static"))
                             (slib   (string-append static "/lib")))
                        (mkdir-p slib)
@@ -891,6 +913,10 @@  (define (linker-script? file)
                                    (rename-file (string-append lib "/" base)
                                                 (string-append slib "/" base)))
                                  files)
+                       (for-each (lambda (base)
+                                   (copy-file (string-append lib "/" base)
+                                              (string-append slib "/" base)))
+                                 files2)
 
                        ;; Usually libm.a is a linker script so we need to
                        ;; change the file names in there to refer to STATIC
diff --git a/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
index e31f99a..b022155 100644
--- a/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
+++ b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
@@ -67,8 +67,8 @@  index fcd79fd554..1dd02aa449 100644
  
 diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c
 index 9d8a9ea8ae..3430582c09 100644
---- a/sysdeps/pthread/timer_create.c
-+++ b/sysdeps/pthread/timer_create.c
+--- a/rt/timer_create.c
++++ b/rt/timer_create.c
 @@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
        return -1;
      }