* [Buildroot] [PATCH v1] Makefile: valgrind needs non-stripped dynamic linker library
@ 2015-10-06 19:51 Peter Seiderer
2015-12-17 22:24 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: Peter Seiderer @ 2015-10-06 19:51 UTC (permalink / raw)
To: buildroot
Fixes the following valgrind error (tested on freescale imx6):
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:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strcmp
valgrind: in an object with soname matching: ld-linux-armhf.so.3
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-armhf.so.3
valgrind:
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 ld.so (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
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 181d446..7f3661f 100644
--- a/Makefile
+++ b/Makefile
@@ -477,11 +477,12 @@ STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
# file exclusions:
# - libpthread.so: a non-stripped libpthread shared library is needed for
# proper debugging of pthread programs using gdb.
+# - ld.so: a non-stripped dynamic linker library is needed for valgrind
# - kernel modules (*.ko): do not function properly when stripped like normal
# applications and libraries. Normally kernel modules are already excluded
# by the executable permission check above, so the explicit exclusion is only
# done for kernel modules with incorrect permissions.
-STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0
+STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0
ifeq ($(BR2_ECLIPSE_REGISTER),y)
define TOOLCHAIN_ECLIPSE_REGISTER
@@ -594,6 +595,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
endif
+# Valgrind needs non-stripped ld.so
+ find $(TARGET_DIR)/lib -type f -name 'ld-*.so*' | \
+ xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
+
mkdir -p $(TARGET_DIR)/etc
# Mandatory configuration file and auxiliary cache directory
# for recent versions of ldconfig
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH v1] Makefile: valgrind needs non-stripped dynamic linker library
2015-10-06 19:51 [Buildroot] [PATCH v1] Makefile: valgrind needs non-stripped dynamic linker library Peter Seiderer
@ 2015-12-17 22:24 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2015-12-17 22:24 UTC (permalink / raw)
To: buildroot
Dear Peter Seiderer,
On Tue, 6 Oct 2015 21:51:36 +0200, Peter Seiderer wrote:
> Fixes the following valgrind error (tested on freescale imx6):
>
> 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:
> valgrind: A must-be-redirected function
> valgrind: whose name matches the pattern: strcmp
> valgrind: in an object with soname matching: ld-linux-armhf.so.3
> valgrind: was not found whilst processing
> valgrind: symbols from the object with soname: ld-linux-armhf.so.3
> valgrind:
> 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 ld.so (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
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
> Makefile | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
I've applied after slightly adjusting the comment in the Makefile: we
are still stripping the dynamic linker, but we are only stripping the
debugging symbols.
I did a quick test on glibc, and here are the numbers:
- Completely unstripped: 755612
- Debugging symbols stripped: 123560 (i.e with your patch)
- Fully stripped: 101548 (i.e without your patch)
Since the difference with your patch is only 22 KB, I thought it was
not worth the effort making it conditional on whether valgrind is used
or not. If other people disagree with this judgment, they are invited
to submit a follow-up patch :-)
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-17 22:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 19:51 [Buildroot] [PATCH v1] Makefile: valgrind needs non-stripped dynamic linker library Peter Seiderer
2015-12-17 22:24 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox