Open stevendanna opened 7 years ago
I can buy this. Looking at what Arch Linux does, they appear to selectively strip some but not all of the ELF binaries: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/glibc#n163. They even call out not stripping ld-${pkgver}.so
so as to not break gdb, valgrind, etc.
I'll see what an update might look like here…
Here is my testing diff to the Glibc plan (currently against the base plans refresh PR):
diff --git a/glibc/plan.sh b/glibc/plan.sh
index 62c63f06..92d5b948 100644
--- a/glibc/plan.sh
+++ b/glibc/plan.sh
@@ -322,6 +322,29 @@ EOF
popd > /dev/null
}
+do_strip() {
+ build_line "Stripping unneeded symbols from binaries and libraries"
+ find $pkg_prefix -type f -perm -u+w -print0 2> /dev/null \
+ | while read -rd '' f; do
+ case "$(basename "$f")" in
+ "ld-${pkg_version}.so"|\
+ "libc-${pkg_version}.so"|\
+ "libpthread-${pkg_version}.so"|\
+ libpthread_db-1.0.so)
+ build_line "Skipping strip for $f"
+ continue
+ ;;
+ esac
+
+ case "$(file -bi "$f")" in
+ *application/x-executable*) strip --strip-all "$f";;
+ *application/x-sharedlib*) strip --strip-unneeded "$f";;
+ *application/x-archive*) strip --strip-debug "$f";;
+ *) continue;;
+ esac
+ done
+}
+
do_end() {
# Clean up the `pwd` link, if we set it up.
if [[ -n "$_clean_pwd" ]]; then
@fnichol , with the patch you posted, is that the only thing we would need to do in order to get core/glibc
to support valgrind?
submitted #2202 so we can get some traction on this. It would be nice to have, although there is something about ArchLinux plan that allows them to strip the shared objects as optional. Perhaps we should have glibc-debug
which includes non-stripped shared objects vs glibc
which does ship stripped objects.
The current version of ld.so that we ship is stripped:
This is of course expected; however, it does cause some problems. For instance valgrind doesn't work on executables using this stripped loader:
This may have been working in the past because of the bug fixed in habitat-sh/habitat@8e8ab126c65a7da8f7cb4b44875683f99fa91c89
The valgrind error message points to 2 solutions: (1) avoid stripping ld.so or (2) ship debugging information in a separate package like some distributions do. (2) would also help for tools like gdb which know how to read debug symbols from auxiliary locations.
https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html http://valgrind.org/docs/manual/dist.readme-packagers.html