jow 5028fab7fe [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
2011-09-06 00:23:30 +00:00

74 lines
2.3 KiB
Makefile

#
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=valgrind
PKG_VERSION:=3.3.1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://valgrind.org/downloads/
PKG_MD5SUM:=0539e2fa4aadb2cd4ca4bba65b1fe8b5
include $(INCLUDE_DIR)/package.mk
define Package/valgrind
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=@TARGET_x86||@TARGET_rdc||@TARGET_ps3||@TARGET_magicbox||@TARGET_amcc||@TARGET_uml
TITLE:=debugging and profiling Linux programs
URL:=http://www.valgrind.org
endef
define Package/valgrind/description
Valgrind is an award-winning suite of tools for debugging and
profiling Linux programs. With the tools that come with Valgrind,
you can automatically detect many memory management and threading
bugs, avoiding hours of frustrating bug-hunting, making your
programs more stable. You can also perform detailed profiling,
to speed up and reduce memory use of your programs.
endef
CONFIGURE_ARGS += \
--disable-tls \
--enable-only32bit \
--without-x \
--without-uiout \
--disable-valgrindmi \
--disable-tui \
--disable-valgrindtk \
--without-included-gettext
DEFAULT_SUPP += "uclibc.supp"
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) -c -o $(PKG_BUILD_DIR)/abort.o ./src/abort.c
$(TARGET_CROSS)ar rcu $(PKG_BUILD_DIR)/abort.a $(PKG_BUILD_DIR)/abort.o
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
DESTDIR="$(PKG_INSTALL_DIR)" \
CFLAGS="$(TARGET_CFLAGS)" \
AM_CFLAGS_X86_LINUX="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/coregrind" \
AM_CFLAGS_AMD64_LINUX="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/coregrind" \
AM_CFLAGS_PPC32_LINUX="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/coregrind" \
AM_CFLAGS_PPC64_LINUX="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/coregrind" \
TOOL_LDADD_COMMON="$(LIBGCC_A) $(PKG_BUILD_DIR)/abort.a" \
all install
endef
define Package/valgrind/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
$(INSTALL_BIN) ./files/valgrind.sh $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib/valgrind
$(CP) ./files/uclibc.supp $(1)/usr/lib/valgrind/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/valgrind/*-linux $(1)/usr/lib/valgrind/
endef
$(eval $(call BuildPackage,valgrind))