[packages] valgrind: fix load address handling
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 6 Sep 2011 00:23:30 +0000 (00:23 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 6 Sep 2011 00:23:30 +0000 (00:23 +0000)
The compile-time generation of the valgrind linker script broke due to toolchain updates
resulting in valgrind binaries compiled with the standard load address of 0x08048000 which
leads to memory conflicts with the debug client later on; valgrind will abort with the
message below:

  valgrind: mmap(0x8048000, 348160) failed in UME with error 22 (Invalid argument).
  valgrind: this can be caused by executables with very large text, data or bss segments.

This change adds another sed pattern to properly substitute the current linker script format.

git-svn-id: svn://svn.openwrt.org/openwrt/packages@28180 3c298f89-4303-0410-b956-a3cf2f4a3e73

utils/valgrind/Makefile
utils/valgrind/patches/002-fix_load_address_substitution.patch [new file with mode: 0644]

index 9fdcaba..3e8cdcb 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=valgrind
 PKG_VERSION:=3.3.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://valgrind.org/downloads/
diff --git a/utils/valgrind/patches/002-fix_load_address_substitution.patch b/utils/valgrind/patches/002-fix_load_address_substitution.patch
new file mode 100644 (file)
index 0000000..41031f6
--- /dev/null
@@ -0,0 +1,76 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -204,26 +204,30 @@ valt_load_address_x86_linux.lds: Makefil
+       $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ valt_load_address_amd64_linux.lds: Makefile
+       $(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ valt_load_address_ppc32_linux.lds: Makefile
+       $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ valt_load_address_ppc64_linux.lds: Makefile
+       $(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -914,28 +914,32 @@ valt_load_address_x86_linux.lds: Makefil
+       $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ valt_load_address_amd64_linux.lds: Makefile
+       $(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ valt_load_address_ppc32_linux.lds: Makefile
+       $(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ valt_load_address_ppc64_linux.lds: Makefile
+       $(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
+               -e '1,/^=====\+$$/d' \
+               -e '/^=====\+$$/d' \
+-              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
++              -e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' \
++              -e '/SEGMENT_START("text-segment", 0x[0-9A-Fa-f]\+)/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
+       || rm -f $@
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.