hisi3531 valgrind 交叉编译移植

valgrind 神器不用我多说,linux平台开发利器。

一、 安装

1. autoconf

# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz 
# tar -zxvf autoconf-2.69.tar.gz 
# cd autoconf-2.69
# ./configure
# make; make install

2. automake

# wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
# tar -zxvf automake-1.14.tar.gz 
# cd automake-1.14
# ./bootstrap.sh
# ./configure
# make; make install

3. valgrind

# wget http://valgrind.org/downloads/valgrind-3.11.0.tar.bz2
# tar -jxvf valgrind-3.11.0.tar.bz2
# cd valgrind-3.11.0
# ./autogen.sh

#./autogen.sh 缺少这步会导致failed to start tool 'memcheck' for platform 'amd64-linux'
修改configure脚本armv7*) 改为armv7* | arm )
arm-hisiv200-linux... 这些命令要在环境变量下哦,不用多说。
./configure --host=arm-linux CC=arm-none-linux-gnueabi-gcc CPP=arm-none-linux-gnueabi-cpp CXX=arm-none-linux-gnueabi-g++ --prefix=/home/dcj/valgrind

./configure \
	--prefix="$PWD/install" \
	CC=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc \
	CXX=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++ \
	CPP=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-cpp \
	AR=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-ar \
	--target=aarch64-himix100-linux \
	--host=aarch64-himix100-linux \
	--program-prefix=hisi-

# sudo make

 #sudo make install

–prefix=/home/dcj/valgrind指定的目录要与开发板上放置的目录一致,不然运行valgrind时可能会出现“valgrind: failed to start tool ‘memcheck’ for platform ‘arm-linux’: No such file or directory”错误。

解决方案:可以看到lib下面还有一层目录valgrind,这时候我们在开发板/etc/profile文件中添加一行
export VALGRIND_LIB=/opt/valgrind-3.12.0/lib/valgrind

可执行文件生成在源码路径

4. 将install/bin目录下的可执行文件hisi-valgrind拷贝到海思板子上,将install/lib目录下的valgrind目录也拷贝到海思板子上,此目录下包含了执行hisi-valgrind时需要的库,然后依次执行如下命令,结果如下图所示:

export VALGRIND_LIB=valgrind/
./hisi-valgrind --version

在这里插入图片描述

  1. 测试代码main.cpp如下:
#include <stdio.h>
#include <iostream>
 
namespace {
 
void func1() {
	int* p1 = new int[10];
}
 
void func2() {
	int* p2 = new int[5];
}
 
} // namespace
 
int main()
{
	fprintf(stdout, "test start\n");
	func1();
	func2();
	fprintf(stdout, "test finish\n");
}

  1. 执行如下命令,生成可执行文件main:

/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++ -g -o main main.cpp
7. 将可执行文件main拷贝到海思板子上,执行如下命令 ,结果如下图所示:

./hisi-valgrind --tool=memcheck --leak-check=full ./main
在这里插入图片描述

configure.in


##------------------------------------------------------------##
# 
# The multiple-architecture stuff in this file is pretty
# cryptic.  Read docs/internals/multiple-architectures.txt
# for at least a partial explanation of what is going on.
#
##------------------------------------------------------------##

# Process this file with autoconf to produce a configure script.
AC_INIT([Valgrind],[3.11.0],[valgrind-users@lists.sourceforge.net])
AC_CONFIG_SRCDIR(coregrind/m_main.c)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign subdir-objects])

AM_MAINTAINER_MODE

#----------------------------------------------------------------------------
# Do NOT modify these flags here. Except in feature tests in which case
# the original values must be properly restored.
#----------------------------------------------------------------------------
CFLAGS="$CFLAGS"
CXXFLAGS="$CXXFLAGS"

#----------------------------------------------------------------------------
# Checks for various programs.
#----------------------------------------------------------------------------

AC_PROG_LN_S
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_CXX
# AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
# autoconf 2.59).  If we ever have any Objective-C code in the Valgrind code
# base (eg. most likely as Darwin-specific tests) we'll need one of the
# following:
# - put AC_PROG_OBJC in a Darwin-specific part of this file
# - Use AC_PROG_OBJC here and up the minimum autoconf version
# - Use the following, which is apparently equivalent:
#     m4_ifdef([AC_PROG_OBJC],
#        [AC_PROG_OBJC],
#        [AC_CHECK_TOOL([OBJC], [gcc])
#         AC_SUBST([OBJC])
#         AC_SUBST([OBJCFLAGS])
#        ])
AC_PROG_RANLIB
# provide a very basic definition for AC_PROG_SED if it's not provided by
# autoconf (as e.g. in autoconf 2.59).
m4_ifndef([AC_PROG_SED],
          [AC_DEFUN([AC_PROG_SED],
                    [AC_ARG_VAR([SED])
                     AC_CHECK_PROGS([SED],[gsed sed])])])
AC_PROG_SED

# If no AR variable was specified, look up the name of the archiver. Otherwise
# do not touch the AR variable.
if test "x$AR" = "x"; then
  AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
fi
AC_ARG_VAR([AR],[Archiver command])

# Check for the compiler support
if test "${GCC}" != "yes" ; then
   AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
fi

# figure out where perl lives
AC_PATH_PROG(PERL, perl)

# figure out where gdb lives
AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])

# some older automake's don't have it so try something on our own
ifdef([AM_PROG_AS],[AM_PROG_AS],
[
AS="${CC}"
AC_SUBST(AS)

ASFLAGS=""
AC_SUBST(ASFLAGS)
])


# Check if 'diff' supports -u (universal diffs) and use it if possible.

AC_MSG_CHECKING([for diff -u])
AC_SUBST(DIFF)

# Comparing two identical files results in 0.
tmpfile="tmp-xxx-yyy-zzz"
touch $tmpfile;
if diff -u $tmpfile $tmpfile ; then
    AC_MSG_RESULT([yes])
    DIFF="diff -u"
else
    AC_MSG_RESULT([no])
    DIFF="diff"
fi
rm $tmpfile


# We don't want gcc < 3.0
AC_MSG_CHECKING([for a supported version of gcc])

# Obtain the compiler version.
# 
# A few examples of how the ${CC} --version output looks like:
#
# ######## gcc variants ########
# Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
# Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
# openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
# Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
# MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
# OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
# OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
#
# ######## clang variants ########
# Clang: clang version 2.9 (tags/RELEASE_29/final)
# Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
# FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
#
# ######## Apple LLVM variants ########
# Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
# Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
#
[
if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
then
    is_clang="applellvm"
    gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
then
    is_clang="clang"
    # Don't use -dumpversion with clang: it will always produce "4.2.1".
    gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ; 
then
    is_clang="icc"
    gcc_version=`${CC} -dumpversion 2>/dev/null`
else
    is_clang="notclang"
    gcc_version=`${CC} -dumpversion 2>/dev/null`
    if test "x$gcc_version" = x; then
	gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
    fi
fi
]
AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)

# Note: m4 arguments are quoted with [ and ] so square brackets in shell
# statements have to be quoted.
case "${is_clang}-${gcc_version}" in
     applellvm-5.1|applellvm-6.*|applellvm-7.*)
	AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
	;;
     icc-1[[3-9]].*)
	AC_MSG_RESULT([ok (ICC version ${gcc_version})])
	;;
     notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
	AC_MSG_RESULT([ok (${gcc_version})])
	;;
     clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
	AC_MSG_RESULT([ok (clang-${gcc_version})])
	;;
     *)
	AC_MSG_RESULT([no (${gcc_version})])
	AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0])
	;;
esac

#----------------------------------------------------------------------------
# Arch/OS/platform tests.
#----------------------------------------------------------------------------
# We create a number of arch/OS/platform-related variables.  We prefix them
# all with "VGCONF_" which indicates that they are defined at
# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
# variables used when compiling C files.

AC_CANONICAL_HOST

AC_MSG_CHECKING([for a supported CPU])

# ARCH_MAX reflects the most that this CPU can do: for example if it
# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
# Ditto for amd64.  It is used for more configuration below, but is not used
# outside this file.
#
# Power PC returns powerpc for Big Endian.  This was not changed when Little
# Endian support was added to the 64-bit architecture.  The 64-bit Little
# Endian systems explicitly state le in the host_cpu.  For clarity in the
# Valgrind code, the ARCH_MAX name will state LE or BE for the endianess of
# the 64-bit system.  Big Endian is the only mode supported on 32-bit Power PC.
# The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
# Endianess.  The name PPC64 or ppc64 to 64-bit systems of either Endianess.
# The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
# Endian.  Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
# Little Endian.

case "${host_cpu}" in
     i?86) 
	AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="x86"
        ;;

     x86_64) 
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="amd64"
        ;;

     powerpc64)
     # this only referrs to 64-bit Big Endian
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="ppc64be"
        ;;

     powerpc64le)
     # this only referrs to 64-bit Little Endian
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="ppc64le"
        ;;

     powerpc)
        # On Linux this means only a 32-bit capable CPU.
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="ppc32"
        ;;

     s390x)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="s390x"
        ;;

     armv7*)
	AC_MSG_RESULT([ok (${host_cpu})])
	ARCH_MAX="arm"
	;;

     aarch64*)
       AC_MSG_RESULT([ok (${host_cpu})])
       ARCH_MAX="arm64"
       ;;

     mips)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="mips32"
        ;;

     mipsel)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="mips32"
        ;;

     mipsisa32r2)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="mips32"
        ;;

     mips64*)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="mips64"
        ;;

     mipsisa64*)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="mips64"
        ;;

     tilegx)
        AC_MSG_RESULT([ok (${host_cpu})])
        ARCH_MAX="tilegx"
        ;;

     *) 
	AC_MSG_RESULT([no (${host_cpu})])
	AC_MSG_ERROR([Unsupported host architecture. Sorry])
	;;
esac

#----------------------------------------------------------------------------

# Sometimes it's convenient to subvert the bi-arch build system and
# just have a single build even though the underlying platform is
# capable of both.  Hence handle --enable-only64bit and
# --enable-only32bit.  Complain if both are issued :-)
# [Actually, if either of these options are used, I think both get built,
# but only one gets installed.  So if you use an in-place build, both can be
# used. --njn]

# Check if a 64-bit only build has been requested
AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
   [AC_ARG_ENABLE(only64bit, 
      [  --enable-only64bit      do a 64-bit only build],
      [vg_cv_only64bit=$enableval],
      [vg_cv_only64bit=no])])

# Check if a 32-bit only build has been requested
AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
   [AC_ARG_ENABLE(only32bit, 
      [  --enable-only32bit      do a 32-bit only build],
      [vg_cv_only32bit=$enableval],
      [vg_cv_only32bit=no])])

# Stay sane
if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
   AC_MSG_ERROR(
      [Nonsensical: both --enable-only64bit and --enable-only32bit.])
fi

#----------------------------------------------------------------------------

# VGCONF_OS is the primary build OS, eg. "linux".  It is passed in to
# compilation of many C files via -VGO_$(VGCONF_OS) and
# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
AC_MSG_CHECKING([for a supported OS])
AC_SUBST(VGCONF_OS)

DEFAULT_SUPP=""

case "${host_os}" in
     *linux*)
	AC_MSG_RESULT([ok (${host_os})])
        VGCONF_OS="linux"

        # Ok, this is linux. Check the kernel version
        AC_MSG_CHECKING([for the kernel version])

        kernel=`uname -r`

        case "${kernel}" in
             0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*) 
        	    AC_MSG_RESULT([unsupported (${kernel})])
        	    AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
        	    ;;

             *)
        	    AC_MSG_RESULT([2.6 or later (${kernel})])
                    ;;
        esac

        ;;

     *darwin*)
        AC_MSG_RESULT([ok (${host_os})])
        VGCONF_OS="darwin"
        AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
        AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
        AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
        AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
        AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
        AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
        AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])

	AC_MSG_CHECKING([for the kernel version])
	kernel=`uname -r`

        # Nb: for Darwin we set DEFAULT_SUPP here.  That's because Darwin
        # has only one relevant version, the OS version. The `uname` check
        # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
        # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
        # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion), 
        # and we don't know of an macros similar to __GLIBC__ to get that info.
        #
        # XXX: `uname -r` won't do the right thing for cross-compiles, but
        # that's not a problem yet.
        #
        # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
        # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
        # on 10.6.8 and 10.7.1.  Although tempted to delete the configure
        # time support for 10.5 (the 9.* pattern just below), I'll leave it
        # in for now, just in case anybody wants to give it a try.  But I'm
        # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
	case "${kernel}" in
	     9.*)
		  AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
		  ;;
	     10.*)
		  AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
		  ;;
	     11.*)
		  AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
		  ;;
	     12.*)
		  AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
		  ;;
	     13.*)
		  AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
		  ;;
	     14.*)
		  AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
		  ;;
	     15.*)
		  AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
		  AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
		  DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
		  DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
		  ;;
             *) 
		  AC_MSG_RESULT([unsupported (${kernel})])
		  AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x and 15.x (Mac OS X 10.6/7/8/9/10/11)])
		  ;;
	esac
        ;;

     solaris2.11*)
        AC_MSG_RESULT([ok (${host_os})])
        VGCONF_OS="solaris"
        DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
        ;;

     solaris2.12*)
        AC_MSG_RESULT([ok (${host_os})])
        VGCONF_OS="solaris"
        DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
        ;;

     *) 
	AC_MSG_RESULT([no (${host_os})])
	AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
	;;
esac

#----------------------------------------------------------------------------

# If we are building on a 64 bit platform test to see if the system
# supports building 32 bit programs and disable 32 bit support if it
# does not support building 32 bit programs

case "$ARCH_MAX-$VGCONF_OS" in
     amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
        AC_MSG_CHECKING([for 32 bit build support])
        safe_CFLAGS=$CFLAGS
        CFLAGS="-m32"
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
          return 0;
        ]])], [
        AC_MSG_RESULT([yes])
        ], [
        vg_cv_only64bit="yes"
        AC_MSG_RESULT([no])
        ])
        CFLAGS=$safe_CFLAGS;;
esac

if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
   AC_MSG_ERROR(
      [--enable-only32bit was specified but system does not support 32 bit builds])
fi

#----------------------------------------------------------------------------

# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64".  By
# default it's the same as ARCH_MAX.  But if, say, we do a build on an amd64
# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
# above) will be "amd64" since that reflects the most that this cpu can do,
# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS).  It is
# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
AC_SUBST(VGCONF_ARCH_PRI)

# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
# It is empty if there is no secondary target.
AC_SUBST(VGCONF_ARCH_SEC)

# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
# The entire system, including regression and performance tests, will be
# built for this target.  The "_CAPS" indicates that the name is in capital
# letters, and it also uses '_' rather than '-' as a separator, because it's
# used to create various Makefile variables, which are all in caps by
# convention and cannot contain '-' characters.  This is in contrast to
# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)

# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
# Valgrind and tools will also be built for this target, but not the
# regression or performance tests.
#
# By default, the primary arch is the same as the "max" arch, as commented
# above (at the definition of ARCH_MAX).  We may choose to downgrade it in
# the big case statement just below here, in the case where we're building
# on a 64 bit machine but have been requested only to do a 32 bit build.
AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)

AC_MSG_CHECKING([for a supported CPU/OS combination])

# NB.  The load address for a given platform may be specified in more 
# than one place, in some cases, depending on whether we're doing a biarch,
# 32-bit only or 64-bit only build.  eg see case for amd64-linux below.
# Be careful to give consistent values in all subcases.  Also, all four
# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
# even if it is to "0xUNSET".
#
case "$ARCH_MAX-$VGCONF_OS" in
     x86-linux)
        VGCONF_ARCH_PRI="x86"
        VGCONF_ARCH_SEC=""
	VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
	VGCONF_PLATFORM_SEC_CAPS=""
        valt_load_address_pri_norml="0x38000000"
        valt_load_address_pri_inner="0x28000000"
        valt_load_address_sec_norml="0xUNSET"
        valt_load_address_sec_inner="0xUNSET"
        AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
	;;
     amd64-linux)
        valt_load_address_sec_norml="0xUNSET"
        valt_load_address_sec_inner="0xUNSET"
	if test x$vg_cv_only64bit = xyes; then
           VGCONF_ARCH_PRI="amd64"
           VGCONF_ARCH_SEC=""
	   VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
	   VGCONF_PLATFORM_SEC_CAPS=""
           valt_load_address_pri_norml="0x38000000"
           valt_load_address_pri_inner="0x28000000"
	elif test x$vg_cv_only32bit = xyes; then
	   VGCONF_ARCH_PRI="x86"
           VGCONF_ARCH_SEC=""
	   VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
	   VGCONF_PLATFORM_SEC_CAPS=""
           valt_load_address_pri_norml="0x38000000"
           valt_load_address_pri_inner="0x28000000"
	else
           VGCONF_ARCH_PRI="amd64"
           VGCONF_ARCH_SEC="x86"
	   VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
	   VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
           valt_load_address_pri_norml="0x38000000"
           valt_load_address_pri_inner="0x28000000"
           valt_load_address_sec_norml="0x38000000"
           valt_load_address_sec_inner="0x28000000"
	fi
        AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
	;;
     ppc32-linux)
        VGCONF_ARCH_PRI="ppc32"
        VGCONF_ARCH_SEC=""
	VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
	VGCONF_PLATFORM_SEC_CAPS=""
        valt_load_address_pri_norml="0x38000000"
        valt_load_address_pri_inner="0x28000000"
        valt_load_address_sec_norml="0xUNSET"
        valt_load_address_sec_inner="0xUNSET"
        AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
	;;
     ppc64be-linux)
        valt_load_address_sec_norml="0xUNSET"
        valt_load_address_sec_inner="0xUNSET"
	if test x$vg_cv_only64bit = xyes; then
	   VGCONF_ARCH_PRI="ppc64be"
           VGCONF_ARCH_SEC=""
	   VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
	   VGCONF_PLATFORM_SEC_CAPS=""
           valt_load_address_pri_norml="0x38000000"
           valt_load_address_pri_inner="0x28000000"
	elif test x$vg_cv_only32bit = xyes; then
	   VGCONF_ARCH_PRI="ppc32"
           VGCONF_ARCH_SEC=""
	   VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
	   VGCONF_PLATFORM_SEC_CAPS=""
           valt_load_address_pri_norml="0x38000000"
           valt_load_address_pri_inner="0x28000000"
	else
	   VGCONF_ARCH_PRI="ppc64be"
           VGCONF_ARCH_SEC="ppc32"
	   VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
	   VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
           valt_load_address_pri_norml="0x38000000"
           valt_load_address_pri_inner="0x28000000"
           valt_load_address_sec_norml="0x38000000"
           valt_load_address_sec_inner="0x28000000"
	fi
        AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
	;;
     ppc64le-linux)
        # Little Endian is only supported on PPC64
        valt_load_address_sec_norml="0xUNSET"
        valt_load_address_sec_inner="0xUNSET"
        VGCONF_ARCH_PRI="ppc64le"
        VGCONF_ARCH_SEC=""
        VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
        VGCONF_PLATFORM_SEC_CAPS=""
        valt_load_address_pri_norml="0x38000000"
        valt_load_address_pri_inner="0x28000000"
        AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
       ;;
     # Darwin gets identified as 32-bit even when it supports 64-bit.
     # (Not sure why, possibly because 'uname' returns "i386"?)  Just about
     # all Macs support both 32-bit and 64-bit, so we just build both.  If
     # someone has a really old 32-bit only machine they can (hopefully?)
     # build with --enable-only32bit.  See bug 243362.
     x86-darwin|amd64-darwin)
        ARCH_MAX="amd64"
        valt_load_address_sec_norml="0xUNSET"
        valt_load_address_sec_inner="0xUNSET"
	if test x$vg_cv_only64bit = xyes; then
           VGCONF_ARCH_PRI="amd64"
           VGCONF_ARCH_SEC=""
	   VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
	   VGCONF_PLATFORM_SEC_CAPS=""
           valt_load_address_pri_norml="0x138000000"
           valt_load_address_pri_inner="0x128000000"
	elif test x$vg_cv_only32bit = xyes; then
           VGCONF_ARCH_PRI="x86"
           VGCONF_ARCH_SEC=""
	   VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
	   VGCONF_
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
根据引用和引用,Valgrind是一种内存检测工具。根据引用,以下是交叉编译Valgrind的步骤: 1. 首先,下载Valgrind的文件,并解压缩。使用命令行输入:tar xvf valgrind-3.**.0.tar.bz2 2. 进入解压缩后的Valgrind目录。使用命令行输入:cd valgrind-3.**.0 3. 运行autogen.sh脚本。使用命令行输入:./autogen.sh 4. 修改configure文件,以支持arm架构。将文件中的armv7*) 改成 armv7*|arm。 5. 使用以下命令进行配置。使用命令行输入:sudo ./configure --host=arm-linux CC=/opt/TI_THREE/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-gcc CPP=/opt/TI_THREE/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-cpp CXX=/opt/TI_THREE/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-g --prefix=/opt/valgrind 6. 运行make命令进行编译。使用命令行输入:sudo make 7. 使用make install命令将Valgrind安装到指定目录。使用命令行输入:sudo make install 8. 最后,将交叉编译好的Valgrind拷贝到开发板上。注意,拷贝的目录要与--prefix指定的目录一致,否则可能会出现错误。 以上是交叉编译Valgrind的步骤。希望对您有帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [hisi3531 valgrind 交叉编译移植](https://blog.csdn.net/lizhangping/article/details/51833997)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [valgrind-3.19.0 内存检测工具 aarch64 6.5.0交叉编译移植版本](https://download.csdn.net/download/u013183495/85810753)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [交叉编译arm系列valgrind步骤](https://blog.csdn.net/juebukeni/article/details/106107523)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值