valgrind: update the package to latest svn, rework and modularize it. tested and working on mips now

git-svn-id: svn://svn.openwrt.org/openwrt/packages@32532 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2012-06-29 19:17:51 +00:00
parent 8750f4d958
commit 5c236f5a53
9 changed files with 312 additions and 541 deletions

View File

@ -8,23 +8,67 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=valgrind
PKG_VERSION:=3.3.1
PKG_RELEASE:=2
PKG_REV:=r12684
PKG_VERSION:=3.7.0+svn_$(PKG_REV)
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://valgrind.org/downloads/
PKG_MD5SUM:=0539e2fa4aadb2cd4ca4bba65b1fe8b5
PKG_SOURCE_URL:=svn://svn.valgrind.org/valgrind/trunk
PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_MIRROR_MD5SUM:=841cfcaf265fae0b866c6cb4c563e3c0
PKG_FIXUP = autoreconf
PKG_INSTALL := 1
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.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
DEPENDS:=@mips||mipsel||i386||arm||armeb||powerpc +libpthread +librt
TITLE:=debugging and profiling tools for Linux
URL:=http://www.valgrind.org
endef
define Package/valgrind/default
$(Package/valgrind)
DEPENDS := valgrind
endef
define Package/valgrind-cachegrind
$(Package/valgrind/default)
TITLE += (cache profiling)
endef
define Package/valgrind-callgrind
$(Package/valgrind/default)
TITLE += (callgraph profiling)
endef
define Package/valgrind-drd
$(Package/valgrind/default)
TITLE += (thread error detection)
endef
define Package/valgrind-massif
$(Package/valgrind/default)
TITLE += (heap profiling)
endef
define Package/valgrind-helgrind
$(Package/valgrind/default)
TITLE += (thread debugging)
endef
define Package/valgrind-vgdb
$(Package/valgrind/default)
TITLE += (GDB interface)
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,
@ -34,9 +78,12 @@ define Package/valgrind/description
to speed up and reduce memory use of your programs.
endef
CONFIGURE_VARS += \
UNAME_R=$(LINUX_VERSION)
CONFIGURE_ARGS += \
--disable-tls \
--enable-only32bit \
--enable-tls \
--without-x \
--without-uiout \
--disable-valgrindmi \
@ -44,30 +91,75 @@ CONFIGURE_ARGS += \
--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_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(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/
$(CP) \
./files/default.supp \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/$(LINUX_KARCH)-*.xml \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/32bit-core*.xml \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/32bit-linux*.xml \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \
$(1)/usr/lib/valgrind/
endef
define Package/valgrind-cachegrind/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib/valgrind
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \
$(1)/usr/lib/valgrind/
endef
define Package/valgrind-callgrind/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib/valgrind
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \
$(1)/usr/lib/valgrind/
endef
define Package/valgrind-drd/install
$(INSTALL_DIR) $(1)/usr/lib/valgrind
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \
$(1)/usr/lib/valgrind/
endef
define Package/valgrind-massif/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/lib/valgrind
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \
$(1)/usr/lib/valgrind/
endef
define Package/valgrind-helgrind/install
$(INSTALL_DIR) $(1)/usr/lib/valgrind
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \
$(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \
$(1)/usr/lib/valgrind/
endef
define Package/valgrind-vgdb/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/
endef
$(eval $(call BuildPackage,valgrind))
$(eval $(call BuildPackage,valgrind-cachegrind))
$(eval $(call BuildPackage,valgrind-callgrind))
$(eval $(call BuildPackage,valgrind-drd))
$(eval $(call BuildPackage,valgrind-massif))
$(eval $(call BuildPackage,valgrind-helgrind))
$(eval $(call BuildPackage,valgrind-vgdb))

View File

@ -0,0 +1,24 @@
{
ld(Addr1)
Memcheck:Addr1
fun:*
obj:/lib/ld-*
}
{
ld(Addr2)
Memcheck:Addr2
fun:*
obj:/lib/ld-*
}
{
ld(Addr4)
Memcheck:Addr4
fun:*
obj:/lib/ld-*
}
{
ld(Cond)
Memcheck:Cond
fun:*
obj:/lib/ld-*
}

View File

@ -1,212 +0,0 @@
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_strdup
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_malloc
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Cond
fun:_dl_get_ready_to_run
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_get_ready_to_run
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_get_ready_to_run
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_get_ready_to_run
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_add_elf_hash_table
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_add_elf_hash_table
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_add_elf_hash_table
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_check_if_named_library_is_loaded
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_check_if_named_library_is_loaded
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_check_hashed_files
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_check_hashed_files
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_load_elf_shared_library
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_load_elf_shared_library
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_load_elf_shared_library
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_load_shared_library
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr1
fun:_dl_find_hash
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_find_hash
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_fixup
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_fixup
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_linux_resolve
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_linux_resolver
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_parse_lazy_relocation_information
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr2
obj:/lib/ld-uClibc*
fun:_dl_parse_lazy_relocation_information
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_parse_lazy_relocation_information
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
obj:/lib/ld-uClibc*
obj:/lib/ld-uClibc*
fun:_dl_parse_lazy_relocation_information
}
{
<insert a suppression name here>
Memcheck:Addr4
obj:/lib/ld-uClibc*
fun:_dl_parse_lazy_relocation_information
}
{
<insert a suppression name here>
Memcheck:Addr2
obj:/lib/ld-uClibc*
fun:_dl_parse_relocation_information
}
{
<insert a suppression name here>
Memcheck:Addr2
fun:_dl_parse_relocation_information
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
fun:_dl_parse_relocation_information
obj:/lib/ld-uClibc*
}
{
<insert a suppression name here>
Memcheck:Addr4
obj:/lib/ld-uClibc*
fun:_dl_parse_relocation_information
}
{
<insert a suppression name here>
Memcheck:Addr4
obj:/lib/ld-uClibc*
obj:/lib/ld-uClibc*
fun:_dl_parse_relocation_information
}
{
<insert a suppression name here>
Memcheck:Addr2
obj:/lib/ld-uClibc-0.9.28.so
fun:*
}
{
<insert a suppression name here>
Memcheck:Addr4
obj:/lib/ld-uClibc-0.9.28.so
fun:*
}

View File

@ -1,10 +0,0 @@
#!/bin/sh -e
#
# Valgrind wrapper
# Use special suppression file for uClibc
export VALGRIND_OPTS="$VALGRIND_OPTS --suppressions=/usr/lib/valgrind/uclibc.supp"
# Use 'exec' to avoid having another shell process hanging around.
exec $0.bin "$@"

View File

@ -1,205 +0,0 @@
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -1165,7 +1165,7 @@
GENXY(__NR_times, sys_times), // 100
PLAXY(__NR_ptrace, sys_ptrace), // 101
GENX_(__NR_getuid, sys_getuid), // 102
- // (__NR_syslog, sys_syslog), // 103
+ LINXY(__NR_syslog, sys_syslog), // 103
GENX_(__NR_getgid, sys_getgid), // 104
GENX_(__NR_setuid, sys_setuid), // 105
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -1582,7 +1582,9 @@
#define VKI_BLKROSET _VKI_IO(0x12,93) /* set device read-only (0 = read-write) */
#define VKI_BLKROGET _VKI_IO(0x12,94) /* get read-only status (0 = read_write) */
+#define VKI_BLKRRPART _VKI_IO(0x12,95) /* re-read partition table */
#define VKI_BLKGETSIZE _VKI_IO(0x12,96) /* return device size /512 (long *arg) */
+#define VKI_BLKFLSBUF _VKI_IO(0x12,97) /* flush buffer cache */
#define VKI_BLKRASET _VKI_IO(0x12,98) /* set read ahead for block device */
#define VKI_BLKRAGET _VKI_IO(0x12,99) /* get current read ahead setting */
#define VKI_BLKFRASET _VKI_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
@@ -1657,6 +1659,54 @@
//#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on) */
#define VKI_SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */
+
+typedef struct vki_scsi_idlun
+{
+ int mux4;
+ int host_unique_id;
+
+} vki_scsi_idlun_t;
+#define VKI_SCSI_IOCTL_GET_IDLUN 0x5382 /* Gets a struct vki_scsi_idlun */
+#define VKI_SCSI_IOCTL_PROBE_HOST 0x5385 /* Gets an arrary describing the SCSI host */
+#define VKI_SCSI_IOCTL_GET_BUS_NUMBER 0x5386 /* Get the bus number for a device */
+
+//----------------------------------------------------------------------
+// From linux-2.6.8.1/include/linux/fd.h
+//----------------------------------------------------------------------
+#define VKI_FDRESET 0x254 /* Takes an int by value */
+#define VKI_FDGETDRVTYP 0x20f /* Returns char floppy_drive_name[16] */
+typedef struct vki_floppy_drive_struct {
+ unsigned long flags;
+ unsigned long spinup_date;
+ unsigned long select_date;
+ unsigned long first_read_date;
+ short probed_format;
+ short track;
+ short maxblock;
+ short maxtrack;
+ int generation;
+ int keep_data;
+ int fd_ref;
+ int fd_device;
+ unsigned long last_checked;
+ char *dmabuf;
+ int bufblocks;
+} vki_floppy_drive_struct_t;
+#define VKI_FDPOLLDRVSTAT 0x213 /* returns a struct floppy_drive_struct */
+typedef struct vki_floppy_struct {
+ unsigned int size;
+ unsigned int sect;
+ unsigned int head;
+ unsigned int track;
+ unsigned int stretch;
+ unsigned char gap;
+ unsigned char rate;
+ unsigned char spec1;
+ unsigned char fmt_gap;
+ const char * name;
+} vki_floppy_struct_t;
+#define VKI_FDGETPRM 0x204 /* returns a struct floppy_struct */
+
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/linux/cdrom.h
//----------------------------------------------------------------------
@@ -1666,6 +1716,7 @@
(struct cdrom_tochdr) */
#define VKI_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
(struct cdrom_tocentry) */
+#define VKI_CDROMEJECT 0x5309 /* Eject cdrom media */
#define VKI_CDROMSUBCHNL 0x530b /* Read subchannel data
(struct cdrom_subchnl) */
#define VKI_CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes)
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -3288,6 +3288,33 @@
case VKI_SG_GET_SG_TABLESIZE: /* 0x227f */
PRE_MEM_WRITE( "ioctl(SG_GET_SG_TABLESIZE)", ARG3, sizeof(int) );
break;
+ case VKI_SCSI_IOCTL_GET_IDLUN:
+ PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_GET_IDLUN)", ARG3, sizeof(vki_scsi_idlun_t) );
+ break;
+ case VKI_SCSI_IOCTL_PROBE_HOST:
+ {
+ int arraylen;
+ char *array = (char*)ARG3;
+ PRE_MEM_READ("ioctl(SCSI_IOCTL_PROBE_HOST)", ARG3, sizeof(char)*4 );
+ arraylen = array[0] + (array[1]<<8) + (array[2]<<16) + (array[3]<<24);
+ PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_PROBE_HOST)", ARG3, sizeof(char)*arraylen );
+ }
+ break;
+ case VKI_SCSI_IOCTL_GET_BUS_NUMBER:
+ PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", ARG3, sizeof(int) );
+ break;
+
+ case VKI_FDRESET:
+ break;
+ case VKI_FDGETDRVTYP:
+ PRE_MEM_WRITE( "ioctl(FDGETDRVTYP)", ARG3, sizeof(char)*16 );
+ break;
+ case VKI_FDPOLLDRVSTAT:
+ PRE_MEM_WRITE( "ioctl(FDPOLLDRVSTAT)", ARG3, sizeof(vki_floppy_drive_struct_t) );
+ break;
+ case VKI_FDGETPRM:
+ PRE_MEM_WRITE( "ioctl(FDGETPRM)", ARG3, sizeof(vki_floppy_struct_t) );
+ break;
case VKI_IIOCGETCPS:
PRE_MEM_WRITE( "ioctl(IIOCGETCPS)", ARG3,
@@ -3611,6 +3638,8 @@
case VKI_BLKROGET:
PRE_MEM_WRITE( "ioctl(BLKROGET)", ARG3, sizeof(int));
break;
+ case VKI_BLKRRPART:
+ break;
case VKI_BLKGETSIZE:
PRE_MEM_WRITE( "ioctl(BLKGETSIZE)", ARG3, sizeof(unsigned long));
break;
@@ -3619,6 +3648,8 @@
case VKI_BLKRAGET:
PRE_MEM_WRITE( "ioctl(BLKRAGET)", ARG3, sizeof(long));
break;
+ case VKI_BLKFLSBUF:
+ break;
case VKI_BLKFRASET:
break;
case VKI_BLKFRAGET:
@@ -3685,6 +3716,8 @@
PRE_MEM_WRITE( "ioctl(CDROMREADTOCENTRY)", ARG3,
sizeof(struct vki_cdrom_tocentry));
break;
+ case VKI_CDROMEJECT:
+ break;
case VKI_CDROMMULTISESSION: /* 0x5310 */
PRE_MEM_WRITE( "ioctl(CDROMMULTISESSION)", ARG3,
sizeof(struct vki_cdrom_multisession));
@@ -4274,6 +4307,28 @@
case VKI_SG_GET_SG_TABLESIZE:
POST_MEM_WRITE(ARG3, sizeof(int));
break;
+ case VKI_SCSI_IOCTL_GET_IDLUN:
+ POST_MEM_WRITE(ARG3, sizeof(vki_scsi_idlun_t));
+ break;
+ case VKI_SCSI_IOCTL_PROBE_HOST:
+ if (RES > 0 && ARG3 )
+ POST_MEM_WRITE(ARG3, sizeof(char)*RES);
+ break;
+ case VKI_SCSI_IOCTL_GET_BUS_NUMBER:
+ POST_MEM_WRITE(ARG3, sizeof(int));
+ break;
+
+ case VKI_FDRESET:
+ break;
+ case VKI_FDGETDRVTYP:
+ POST_MEM_WRITE( ARG3, sizeof(char)*16 );
+ break;
+ case VKI_FDPOLLDRVSTAT:
+ POST_MEM_WRITE( ARG3, sizeof(vki_floppy_drive_struct_t) );
+ break;
+ case VKI_FDGETPRM:
+ POST_MEM_WRITE( ARG3, sizeof(vki_floppy_struct_t) );
+ break;
case VKI_IIOCGETCPS:
POST_MEM_WRITE( ARG3, VKI_ISDN_MAX_CHANNELS * 2 * sizeof(unsigned long) );
@@ -4492,6 +4547,8 @@
case VKI_BLKROGET:
POST_MEM_WRITE(ARG3, sizeof(int));
break;
+ case VKI_BLKRRPART:
+ break;
case VKI_BLKGETSIZE:
POST_MEM_WRITE(ARG3, sizeof(unsigned long));
break;
@@ -4500,6 +4557,8 @@
case VKI_BLKRAGET:
POST_MEM_WRITE(ARG3, sizeof(long));
break;
+ case VKI_BLKFLSBUF:
+ break;
case VKI_BLKFRASET:
break;
case VKI_BLKFRAGET:
@@ -4541,6 +4600,8 @@
case VKI_CDROMREADTOCENTRY:
POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_tocentry));
break;
+ case VKI_CDROMEJECT:
+ break;
case VKI_CDROMMULTISESSION:
POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_multisession));
break;

View File

@ -1,76 +0,0 @@
--- 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.

View File

@ -1,10 +0,0 @@
--- a/coregrind/m_debuginfo/readstabs.c
+++ b/coregrind/m_debuginfo/readstabs.c
@@ -44,6 +44,7 @@
#include "priv_readstabs.h" /* self */
/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
+#define CONFIG_ARCH_SUPPORTS_AOUT /* XXX */
#include <a.out.h> /* stabs defns */
/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */

View File

@ -0,0 +1,11 @@
--- a/configure.in
+++ b/configure.in
@@ -260,7 +260,7 @@ case "${host_os}" in
# Ok, this is linux. Check the kernel version
AC_MSG_CHECKING([for the kernel version])
- kernel=`uname -r`
+ kernel=${UNAME_R:-`uname -r`}
case "${kernel}" in
2.6.*|3.*)

View File

@ -0,0 +1,157 @@
--- /dev/null
+++ b/include/a.out.h
@@ -0,0 +1,138 @@
+#ifndef __A_OUT_GNU_H__
+#define __A_OUT_GNU_H__
+
+#include <bits/a.out.h>
+
+#define __GNU_EXEC_MACROS__
+
+struct exec
+{
+ unsigned long a_info; /* Use macros N_MAGIC, etc for access. */
+ unsigned int a_text; /* Length of text, in bytes. */
+ unsigned int a_data; /* Length of data, in bytes. */
+ unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */
+ unsigned int a_syms; /* Length of symbol table data in file, in bytes. */
+ unsigned int a_entry; /* Start address. */
+ unsigned int a_trsize;/* Length of relocation info for text, in bytes. */
+ unsigned int a_drsize;/* Length of relocation info for data, in bytes. */
+};
+
+enum machine_type
+{
+ M_OLDSUN2 = 0,
+ M_68010 = 1,
+ M_68020 = 2,
+ M_SPARC = 3,
+ M_386 = 100,
+ M_MIPS1 = 151,
+ M_MIPS2 = 152
+};
+
+#define N_MAGIC(exec) ((exec).a_info & 0xffff)
+#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
+#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
+#define N_SET_INFO(exec, magic, type, flags) \
+ ((exec).a_info = ((magic) & 0xffff) \
+ | (((int)(type) & 0xff) << 16) \
+ | (((flags) & 0xff) << 24))
+#define N_SET_MAGIC(exec, magic) \
+ ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
+#define N_SET_MACHTYPE(exec, machtype) \
+ ((exec).a_info = \
+ ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
+#define N_SET_FLAGS(exec, flags) \
+ ((exec).a_info = \
+ ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
+
+/* Code indicating object file or impure executable. */
+#define OMAGIC 0407
+/* Code indicating pure executable. */
+#define NMAGIC 0410
+/* Code indicating demand-paged executable. */
+#define ZMAGIC 0413
+/* This indicates a demand-paged executable with the header in the text.
+ The first page is unmapped to help trap NULL pointer references. */
+#define QMAGIC 0314
+/* Code indicating core file. */
+#define CMAGIC 0421
+
+#define N_TRSIZE(a) ((a).a_trsize)
+#define N_DRSIZE(a) ((a).a_drsize)
+#define N_SYMSIZE(a) ((a).a_syms)
+#define N_BADMAG(x) \
+ (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
+ && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
+#define _N_HDROFF(x) (1024 - sizeof (struct exec))
+#define N_TXTOFF(x) \
+ (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
+ (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
+#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
+#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
+#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
+#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
+#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
+
+/* Address of text segment in memory after it is loaded. */
+#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0)
+
+/* Address of data segment in memory after it is loaded. */
+#define SEGMENT_SIZE 1024
+
+#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
+#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
+
+#define N_DATADDR(x) \
+ (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
+ : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
+#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
+
+#if !defined (N_NLIST_DECLARED)
+struct nlist
+{
+ union
+ {
+ char *n_name;
+ struct nlist *n_next;
+ long n_strx;
+ } n_un;
+ unsigned char n_type;
+ char n_other;
+ short n_desc;
+ unsigned long n_value;
+};
+#endif /* no N_NLIST_DECLARED. */
+
+#define N_UNDF 0
+#define N_ABS 2
+#define N_TEXT 4
+#define N_DATA 6
+#define N_BSS 8
+#define N_FN 15
+#define N_EXT 1
+#define N_TYPE 036
+#define N_STAB 0340
+#define N_INDR 0xa
+#define N_SETA 0x14 /* Absolute set element symbol. */
+#define N_SETT 0x16 /* Text set element symbol. */
+#define N_SETD 0x18 /* Data set element symbol. */
+#define N_SETB 0x1A /* Bss set element symbol. */
+#define N_SETV 0x1C /* Pointer to set vector in data area. */
+
+#if !defined (N_RELOCATION_INFO_DECLARED)
+/* This structure describes a single relocation to be performed.
+ The text-relocation section of the file is a vector of these structures,
+ all of which apply to the text section.
+ Likewise, the data-relocation section applies to the data section. */
+
+struct relocation_info
+{
+ int r_address;
+ unsigned int r_symbolnum:24;
+ unsigned int r_pcrel:1;
+ unsigned int r_length:2;
+ unsigned int r_extern:1;
+ unsigned int r_pad:4;
+};
+#endif /* no N_RELOCATION_INFO_DECLARED. */
+
+#endif /* __A_OUT_GNU_H__ */
--- /dev/null
+++ b/include/bits/a.out.h
@@ -0,0 +1,13 @@
+#ifndef __A_OUT_GNU_H__
+# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+
+/* Signal to users of this header that this architecture really doesn't
+ support a.out binary format. */
+#define __NO_A_OUT_SUPPORT 1
+
+#endif