Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920745 - dostrip: add some way to fine-tune the stripping performed
Summary: dostrip: add some way to fine-tune the stripping performed
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
Depends on:
Blocks: 933986
  Show dependency tree
Reported: 2023-12-26 21:46 UTC by Eli Schwartz
Modified: 2024-07-20 19:34 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Eli Schwartz gentoo-dev 2023-12-26 21:46:41 UTC
Example use case: glibc installs When stripping symbols, this can throw a kink into the operation of e.g. valgrind.

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname:
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:  Note that if you are debugging a 32 bit process on a
valgrind:  64 bit system, you will need a corresponding 32 bit debuginfo
valgrind:  package (e.g. libc6-dbg:i386).
valgrind:  Cannot continue -- exiting now.  Sorry.

Per discussion:

<ztrawhcse> sam_: I feel like should never be stripped, really.
<sam_> the thing is even without debugging symbols
<sam_> symtab would help valgrind a lot
<ztrawhcse> sam_: I guess dostrip doesn't let you pass suppression arguments to strip such as suppressing removal of symtab...
<sam_> unfortunately not, although this is an interesting idea
<sam_> (and perhaps one to explore for EAPI 9)
Comment 1 Eli Schwartz gentoo-dev 2023-12-26 21:56:39 UTC
More generally, from the glibc ebuild:

# Note [Disable automatic stripping]
# Disabling automatic stripping for a few reasons:
# - portage's attempt to strip breaks non-native binaries at least on
#   arm: bug #697428
# - portage's attempt to strip breaks gdb thread
#   enumeration: bug #697910. This is quite subtle:
#   * gdb uses glibc's to enumerate threads.
#   * needs access to local symbols
#     via 'ps_pglobal_lookup' symbol defined in gdb.
#   * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
#     known symbols in ''. Specifically 'nptl_version'
#     (unexported) is used to sanity check compatibility before enabling
#     debugging.
#     Also see
#   * normal 'strip' command trims '.symtab'
#   Thus our main goal here is to prevent '' from
#   losing it's '.symtab' entries.
# As Gentoo's strip does not allow us to pass less aggressive stripping
# options and does not check the machine target we strip selectively.

The last two lines here are key.