FS#73792 - [glibc] Enable debug symbols such that it works with debuginfod

Attached to Project: Arch Linux
Opened by Arvid Norlander (VorpalGun) - Monday, 14 February 2022, 22:28 GMT
Last edited by freswa (frederik) - Friday, 13 May 2022, 15:55 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To freswa (frederik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

This may be something that is already being worked on, and if so I apologise. I know the toolchain has been in a bit of a complicated state recently.

Currently, there doesn't seem to be debug symbols for glibc. This may be related to the special handling of stripping in the PKGBUILD. As glibc (and other parts of the toolchain) are core components that are likely to end up in many different binaries, it would be advantageous to have debug symbols available.

Additional info:
* package version(s): glibc 2.35-2
* config and/or log files etc. N/A
* link to upstream bug report, if any N/A

Steps to reproduce:
1. Set up debuginfod. (See https://wiki.archlinux.org/title/Debuginfod for details)
2. Test it using for example: gdb /bin/bash
3. break main
4. info sharedlibrary

Note output shows:

From To Syms Read Shared Object Library
0x00007ffff7fc8000 0x00007ffff7fee535 Yes (*) /lib64/ld-linux-x86-64.so.2
0x00007ffff7f4e020 0x00007ffff7f78d68 Yes /usr/lib/libreadline.so.8
0x00007ffff7f33020 0x00007ffff7f330f5 Yes (*) /usr/lib/libdl.so.2
0x00007ffff7d54440 0x00007ffff7ec869d Yes (*) /usr/lib/libc.so.6
0x00007ffff7cca020 0x00007ffff7d0add0 Yes /usr/lib/libncursesw.so.6
(*): Shared library is missing debugging information.

Here we can see that full debug symbols are available for readline and ncurses, but only symbol tables from glibc (libc, libdl, ld-linux-x86-64).
This task depends upon

Closed by  freswa (frederik)
Friday, 13 May 2022, 15:55 GMT
Reason for closing:  Implemented
Additional comments about closing:  glibc-2.35-5 in [testing]
Comment by Arvid Norlander (VorpalGun) - Monday, 14 February 2022, 22:29 GMT
Sorry, that output was gdb output horribly formatted, but I don't know how to do fancy formatting in this bug tracker.
Comment by freswa (frederik) - Sunday, 20 February 2022, 19:51 GMT
We can't just provide debugsymbols, as our current approach only allows to strip all binaries. Though some of the glibc libs need to keep their symbols in order to work with e.g. valgrind. So this is waiting on improvements on the devtools side.

edit: s/vagrant/valgrind
Comment by Toolybird (Toolybird) - Sunday, 20 February 2022, 21:30 GMT
> in order to work with e.g. vagrant

valgrind?

On a related note, the current PKGBUILD is buggy WRT to stripping due to the .so name changes introduced in glibc-2.34

"Previously, glibc installed its various shared objects under versioned
file names such as libc-2.33.so. The ABI sonames (e.g., libc.so.6)
were provided as symbolic links. Starting with glibc 2.34, the shared
objects are installed under their ABI sonames directly, without
symbolic links."

Patch attached. I believe it to be correct but please sanity check it.
Comment by Arvid Norlander (VorpalGun) - Monday, 21 February 2022, 08:10 GMT
Hm, can't valgrind use the debug symbols instead from debuginfod? I had a poke around on a Ubuntu LTS 20.04 machine and they seem to do it that way (well, using -dbg packages, 20.04 is too old for debuginfod):

$ file /lib/x86_64-linux-gnu/ld-2.31.so /lib/x86_64-linux-gnu/libc-2.31.so
/lib/x86_64-linux-gnu/ld-2.31.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=ea85fcb25ee4c4c9e7b180924ab4a44257a9547a, stripped
/lib/x86_64-linux-gnu/libc-2.31.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=ce782ece08d088e77eeadc086f84d4888de4bb42, for GNU/Linux 3.2.0, stripped

$ nm /lib/x86_64-linux-gnu/libc-2.31.so /lib/x86_64-linux-gnu/ld-2.31.so

/lib/x86_64-linux-gnu/libc-2.31.so:
nm: /lib/x86_64-linux-gnu/libc-2.31.so: no symbols
/lib/x86_64-linux-gnu/ld-2.31.so:
nm: /lib/x86_64-linux-gnu/ld-2.31.so: no symbols
Comment by freswa (frederik) - Wednesday, 02 March 2022, 20:51 GMT
I worked on this today. Valgrind works with debuginfod since 2021. Though, we have an reproducibility issue here. The debug symbols are needed for the valgrind package to run check(). The glibc-debug package can not be fetched with the default pacman repo configuration. This has to be worked out before glibc-debug can be provided.
Comment by Arvid Norlander (VorpalGun) - Tuesday, 19 April 2022, 13:49 GMT
I hate to be that guy, but... any progress on this? Perhaps more constructively is there anything I as an Arch user (with software development skills) could do to help with this?

If it is waiting on being able to get debug packages onto the build servers I guess not, but is there a separate bug for that issue then?
Comment by freswa (frederik) - Wednesday, 20 April 2022, 15:14 GMT
You could help us improve makepkg to be able to add -debug packages as makedeps. Feel free to join us on IRC :)

Loading...