From 5028fab7fe2ab64fccca84c141f853988bb141f3 Mon Sep 17 00:00:00 2001 From: jow Date: Tue, 6 Sep 2011 00:23:30 +0000 Subject: [PATCH] [packages] valgrind: fix load address handling 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 | 4 +- .../002-fix_load_address_substitution.patch | 76 +++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 utils/valgrind/patches/002-fix_load_address_substitution.patch diff --git a/utils/valgrind/Makefile b/utils/valgrind/Makefile index 9fdcabaf4..3e8cdcbd9 100644 --- a/utils/valgrind/Makefile +++ b/utils/valgrind/Makefile @@ -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 index 000000000..41031f63a --- /dev/null +++ b/utils/valgrind/patches/002-fix_load_address_substitution.patch @@ -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.