|
From: Josef W. <Jos...@gm...> - 2005-10-26 19:18:42
|
Hi,
I somehow succeeded in linking callgrind as static binary.
The first question was which information for linking
to pass via valgrind.pc? I decided to pass the load address
as separate variable (valt_load_address), and the libraries to
link. And these libraries must be installed by VG. Thus this
needs the following patch to VG SVN:
===================================================================
--- valgrind.pc.in (Revision 4967)
+++ valgrind.pc.in (Arbeitskopie)
@@ -5,11 +5,12 @@
arch=@VG_ARCH@
os=@VG_OS@
platform=@VG_PLATFORM@
+valt_load_address=@VALT_LOAD_ADDRESS@
Name: Valgrind
Description: A dynamic binary instrumentation framework
Version: @VERSION@
Requires:
-Libs:
+Libs: -L${libdir} -lcoregrind -lvex -lgcc
Cflags: -I${includedir} @ARCH_TOOL_AM_CFLAGS@
--- coregrind/Makefile.am (Revision 4968)
+++ coregrind/Makefile.am (Arbeitskopie)
@@ -6,7 +6,7 @@
default.supp: $(SUPP_FILES)
-noinst_LIBRARIES = \
+lib_LIBRARIES = \
libcoregrind.a \
libreplacemalloc_toolpreload.a
===================================================================
Problem: How and where to install libvex.a? Adding it to
coregrind/Makefile.am as "lib_LIBRARIES = ... @VEXDIR@/libvex.a"
does not work, as automake wants to build this library from
a "../VEX/libvex.c" file ?!
I decided to pass the libraries in valgrind.pc so that the
tools configure.in can check if all libraries are available at
configure time without hardcoding.
I think that libreplacemalloc_toolpreload.a should be installed,
too: an external tool may choose to overwrite malloc().
Now, when trying to run the tool, I get a panic inside of my
instrument() function:
Callgrind: the 'impossible' happened:
host/guest word size mismatch
Code:
IRBB* CLG_(instrument)( IRBB* bbIn, VexGuestLayout* layout,
IRType gWordTy, IRType hWordTy )
{
...
if (gWordTy != hWordTy) {
/* We don't currently support this case. */
VG_(tool_panic)("host/guest word size mismatch");
}
...
I probably miss something here.
The CFLAGS used to compile callgrind for x86 are
gcc ... -DVGA_x86 -DVGO_linux -I/usr/include/valgrind \
-m32 -mpreferred-stack-boundary=2 -g -O2 ...
and I of course compiled VEX on the same machine.
Help!
Josef
|