valgrind comes with a pkgconfig file valgrind.pc. One of the values it defines is valt_load_address. This can be used to build valgrind tools "out of tree". The result of $(pkg-config --variable=valt_load_address valgrind) can be used as the value of -Ttext= when building a tool. Example makefile snippet: VALT_LOAD_ADDRESS = $(shell pkg-config --variable=valt_load_address valgrind) all: mytool mytool: my_tool.o $(CC) -static -nodefaultlibs -nostartfiles -o $@ -u _start \ -Wl,--build-id=none,-Ttext=$(VALT_LOAD_ADDRESS) $< \ $(shell pkg-config --libs valgrind) .c.o: $(CC) $(CFLAGS) -c $^ This is currently broken since VALT_LOAD_ADDRESS has been replaced by VALT_LOAD_ADDRESS_PRI. But valgrind.pc.in still contains: valt_load_address=@VALT_LOAD_ADDRESS@ Simple fix: Index: valgrind.pc.in =================================================================== --- valgrind.pc.in (revision 13016) +++ valgrind.pc.in (working copy) @@ -5,7 +5,7 @@ arch=@VGCONF_ARCH_PRI@ os=@VGCONF_OS@ platform=@VGCONF_ARCH_PRI@-@VGCONF_OS@ -valt_load_address=@VALT_LOAD_ADDRESS@ +valt_load_address=@VALT_LOAD_ADDRESS_PRI@ Name: Valgrind Description: A dynamic binary instrumentation framework This is also fedora bug #827219 https://bugzilla.redhat.com/show_bug.cgi?id=827219
Committed as r13018.