]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Somewhat rehash the biarch-build machinery so as to (1) formalise the
authorJulian Seward <jseward@acm.org>
Wed, 4 Jan 2006 01:20:28 +0000 (01:20 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 4 Jan 2006 01:20:28 +0000 (01:20 +0000)
distinction between primary and secondary build targets, and (2) make
it independent of the default behaviour of gcc (iow, what gcc does
when you specify neither -m32 nor -m64).

As a result, an out-of-the-box build on ppc64-linux now builds a
system which is basically for 64-bit PowerPC, but also has the ability
to run 32-bit ppc-linux binaries (exactly the same arrangement as you
get when building on amd64-linux).

There are various twists and turns.  multiple-architectures.txt is
updated all the gory details.

This will break amd64 builds until such time as
<tool>/tests/{amd64,x86}/Makefile.am are fixed up (shortly).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5493

19 files changed:
Makefile.flags.am
auxprogs/Makefile.am
cachegrind/tests/Makefile.am
cachegrind/tests/ppc32/Makefile.am
cachegrind/tests/ppc64/Makefile.am
configure.in
coregrind/Makefile.am
docs/internals/multiple-architectures.txt
helgrind/tests/Makefile.am
massif/hp2ps/Makefile.am
massif/tests/Makefile.am
memcheck/tests/Makefile.am
memcheck/tests/ppc32/Makefile.am
memcheck/tests/ppc64/Makefile.am
none/tests/Makefile.am
none/tests/ppc32/Makefile.am
none/tests/ppc64/Makefile.am
perf/Makefile.am
tests/Makefile.am

index 1d4555ec86eef5f52ccb86e2ab40fd7c6c321909..5af69c47135abe7c1096a1dafe8ba154a5afee5c 100644 (file)
@@ -1,24 +1,38 @@
+
+# Baseline flags for all compilations
 AM_CFLAGS_BASE = -O -g -Wmissing-prototypes -Winline -Wall -Wshadow \
                  -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
 
 AM_CFLAGS_PIC = -fpic -fno-omit-frame-pointer
 
-AM_CPPFLAGS_X86_LINUX = $(add_includes_x86_linux)
-AM_CFLAGS_X86_LINUX = $(WERROR) @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ $(AM_CFLAGS_BASE)
-AM_CCASFLAGS_X86_LINUX = $(add_includes_x86_linux) @FLAG_M32@ -g
+# Flags for specific targets
+AM_FLAG_M3264_X86_LINUX   = @FLAG_M32@
+AM_CPPFLAGS_X86_LINUX     = $(add_includes_x86_linux)
+AM_CFLAGS_X86_LINUX       = $(WERROR) @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ \
+                               $(AM_CFLAGS_BASE)
+AM_CCASFLAGS_X86_LINUX    = $(add_includes_x86_linux) @FLAG_M32@ -g
 
-AM_CPPFLAGS_AMD64_LINUX = $(add_includes_amd64_linux)
-AM_CFLAGS_AMD64_LINUX = $(WERROR) -m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ $(AM_CFLAGS_BASE)
-AM_CCASFLAGS_AMD64_LINUX = $(add_includes_amd64_linux) -m64 -g
+AM_FLAG_M3264_AMD64_LINUX = @FLAG_M64@
+AM_CPPFLAGS_AMD64_LINUX   = $(add_includes_amd64_linux)
+AM_CFLAGS_AMD64_LINUX     = $(WERROR) @FLAG_M64@ -fomit-frame-pointer \
+                                @PREFERRED_STACK_BOUNDARY@ $(AM_CFLAGS_BASE)
+AM_CCASFLAGS_AMD64_LINUX  = $(add_includes_amd64_linux) -m64 -g
 
-AM_CPPFLAGS_PPC32_LINUX = $(add_includes_ppc32_linux)
-AM_CFLAGS_PPC32_LINUX = $(WERROR) @FLAG_M32@ $(AM_CFLAGS_BASE)
-AM_CCASFLAGS_PPC32_LINUX = $(add_includes_ppc32_linux) -Wa,-maltivec @FLAG_M32@ -g
+AM_FLAG_M3264_PPC32_LINUX = @FLAG_M32@
+AM_CPPFLAGS_PPC32_LINUX   = $(add_includes_ppc32_linux)
+AM_CFLAGS_PPC32_LINUX     = $(WERROR) @FLAG_M32@ $(AM_CFLAGS_BASE)
+AM_CCASFLAGS_PPC32_LINUX  = $(add_includes_ppc32_linux) -Wa,-maltivec @FLAG_M32@ -g
 
-AM_CPPFLAGS_PPC64_LINUX = $(add_includes_ppc64_linux)
-AM_CFLAGS_PPC64_LINUX = $(WERROR) -m64 $(AM_CFLAGS_BASE)
-AM_CCASFLAGS_PPC64_LINUX = $(add_includes_ppc64_linux) -Wa,-maltivec -m64 -g
+AM_FLAG_M3264_PPC64_LINUX = @FLAG_M64@
+AM_CPPFLAGS_PPC64_LINUX   = $(add_includes_ppc64_linux)
+AM_CFLAGS_PPC64_LINUX     = $(WERROR) @FLAG_M64@ $(AM_CFLAGS_BASE)
+AM_CCASFLAGS_PPC64_LINUX  = $(add_includes_ppc64_linux) -Wa,-maltivec -m64 -g
 
-AM_CPPFLAGS = $(AM_CPPFLAGS_@VG_MAKE_PLATFORM@)
-AM_CFLAGS = $(AM_CFLAGS_@VG_MAKE_PLATFORM@)
-AM_CCASFLAGS = $(AM_CCASFLAGS_@VG_MAKE_PLATFORM@)
+# Flags for the primary target.  These must be used to build the
+# regtests and performance tests.  In fact, these must be used to
+# build anything which is built only once on a dual-arch build.
+#
+AM_FLAG_M3264_PRI = $(AM_FLAG_M3264_@VG_PLATFORM_PRI@)
+AM_CPPFLAGS_PRI   = $(AM_CPPFLAGS_@VG_PLATFORM_PRI@)
+AM_CFLAGS_PRI     = $(AM_CFLAGS_@VG_PLATFORM_PRI@)
+AM_CCASFLAGS_PRI  = $(AM_CCASFLAGS_@VG_PLATFORM_PRI@)
index abaf6aa170c800128e2cde5f910fe9978f1c4b68..85cc0cd1d9ca3d19727e6d01ff17838df4414f3e 100644 (file)
@@ -8,5 +8,17 @@ noinst_SCRIPTS = gen-mdg DotToScc.hs primes.c \
 
 EXTRA_DIST = $(noinst_SCRIPTS)
 
+
+#------------------------- listener -----------------------
+# Build valgrind_listener for the primary target only.
+#
 valgrind_listener_SOURCES = valgrind-listener.c
 
+valgrind_listener_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
+valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI)
+valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI)
+valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI)
+#
+#----------------------------------------------------------
+
+
index aee2531ef6563a61f9843f566b13cd37bbb76a4d..15c35060b683659527bd739272ff97f2f19d1f87 100644 (file)
@@ -1,3 +1,7 @@
+
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 SUBDIRS = .
 if VG_X86_LINUX
 SUBDIRS += x86
@@ -24,10 +28,10 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
 check_PROGRAMS = \
        chdir clreq dlclose myprint.so
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 
 # C ones
 dlclose_LDADD          = -ldl
 myprint_so_SOURCES     = myprint.c
-myprint_so_LDFLAGS     = -shared -fPIC
-myprint_so_CFLAGS      = -fPIC
+myprint_so_LDFLAGS     = $(AM_FLAG_M3264_PRI) -shared -fPIC
+myprint_so_CFLAGS      = $(AM_FLAG_M3264_PRI) -fPIC
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..123b3a991641ab45f0dd304db8c05c6aaf7aaad2 100644 (file)
@@ -0,0 +1,3 @@
+
+# if any tests appear here, remember to include @FLAG_M32@ in the
+# compilation flags
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..237719404dad35232e7e8f4420d0efdf63544c6e 100644 (file)
@@ -0,0 +1,3 @@
+
+# if any tests appear here, remember to include @FLAG_M64@ in the
+# compilation flags
index 68025957895262d03c6415f3cd1b0897ee92f8a9..a157ac6e1e2bfefb153d52e07feecb064ae88691 100644 (file)
@@ -1,3 +1,12 @@
+
+##------------------------------------------------------------##
+# 
+# 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.2.0.SVN, valgrind-users@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(coregrind/m_main.c)
@@ -73,11 +82,6 @@ ASFLAGS=""
 AC_SUBST(ASFLAGS)
 ])
 
-# This variable will collect the individual suppression files
-# depending on the results of autoconf
-
-DEFAULT_SUPP=""
-
 
 # We don't want gcc < 3.0
 AC_MSG_CHECKING([for a supported version of gcc])
@@ -209,48 +213,73 @@ case "${host_os}" in
        ;;
 esac
 
-AC_MSG_CHECKING([for a supported CPU/OS combination])
-AC_SUBST(VG_PLATFORM)
+# What's this used for?
 AC_SUBST(VG_PLATFORM_ALL)
 VG_PLATFORM_ALL="amd64-linux ppc32-linux ppc64-linux x86-linux"
 
-VG_PLATFORM="$VG_ARCH-$VG_OS"
-
-case $VG_PLATFORM in
-    x86-linux|amd64-linux|ppc32-linux|ppc64-linux)
-        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
-        ;;
-
-    *)
-        AC_MSG_RESULT([no (${host_cpu}-${host_os})])
-        AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
-        ;;
-esac
+# Establish VG_PLATFORM_PRI.  This is the primary build target.  The
+# entire system, including regression and performance tests, will be
+# built for this target.  On 32-bit systems this is the only build
+# target.
+#
+# Now establish VG_PLATFORM_SEC, the secondary build target, if
+# possible.  The system will also be built for this target, but not
+# the regression or performance tests.  Also decide what -m32/-m64
+# flags are needed for the primary and secondary build targets.
+# XXXXXXXXXXXXX is this needed?
+#
+AC_MSG_CHECKING([for a supported CPU/OS combination])
 
-AM_CONDITIONAL(VG_X86_LINUX,   test x$VG_PLATFORM = xx86-linux -o x$VG_PLATFORM = xamd64-linux)
-AM_CONDITIONAL(VG_AMD64_LINUX, test x$VG_PLATFORM = xamd64-linux)
-AM_CONDITIONAL(VG_PPC32_LINUX, test x$VG_PLATFORM = xppc32-linux -o x$VG_PLATFORM = xppc64-linux)
-AM_CONDITIONAL(VG_PPC64_LINUX, test x$VG_PLATFORM = xppc64-linux)
+AC_SUBST(VG_PLATFORM_PRI)
+AC_SUBST(VG_PLATFORM_SEC)
 
-AC_SUBST(VG_MAKE_PLATFORM)
-case $VG_PLATFORM in
+case "$VG_ARCH-$VG_OS" in
      x86-linux)
-       VG_MAKE_PLATFORM=X86_LINUX
+       VG_PLATFORM_PRI="X86_LINUX"
+       VG_PLATFORM_SEC=""
+        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
        ;;
      amd64-linux)
-       VG_MAKE_PLATFORM=AMD64_LINUX
+       VG_PLATFORM_PRI="AMD64_LINUX"
+       VG_PLATFORM_SEC="X86_LINUX"
+        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
        ;;
-     ppc32-linux|ppc64-linux)
-       VG_MAKE_PLATFORM=PPC32_LINUX
+     ppc32-linux)
+       VG_PLATFORM_PRI="PPC32_LINUX"
+       VG_PLATFORM_SEC=""
+        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
        ;;
-     *)
-       AC_MSG_ERROR([VG_PLATFORM is not known -- configure script bug])
+     ppc64-linux)
+       VG_PLATFORM_PRI="PPC64_LINUX"
+       VG_PLATFORM_SEC="PPC32_LINUX"
+        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
        ;;
+    *)
+       VG_PLATFORM_PRI="unknown"
+       VG_PLATFORM_SEC="unknown"
+        AC_MSG_RESULT([no (${host_cpu}-${host_os})])
+        AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
+        ;;
 esac
-##VG_MAKE_PLATFORM=`echo $VG_PLATFORM | tr [a-z-] [A-Z_]`
 
+# Set up VG_<platform>.  Either one or two of these become defined.
+#
+AM_CONDITIONAL(VG_X86_LINUX,   
+               test x$VG_PLATFORM_PRI = xX86_LINUX -o x$VG_PLATFORM_PRI = xAMD64_LINUX)
+AM_CONDITIONAL(VG_AMD64_LINUX, 
+               test x$VG_PLATFORM_PRI = xAMD64_LINUX)
+AM_CONDITIONAL(VG_PPC32_LINUX, 
+               test x$VG_PLATFORM_PRI = xPPC32_LINUX -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
+AM_CONDITIONAL(VG_PPC64_LINUX, 
+               test x$VG_PLATFORM_PRI = xPPC64_LINUX)
+
+
+# This variable will collect the individual suppression files
+# depending on the results of autoconf
+DEFAULT_SUPP=""
 AC_SUBST(DEFAULT_SUPP)
 
+
 glibc=""
 
 AC_EGREP_CPP([GLIBC_22], [
@@ -289,19 +318,19 @@ case "${glibc}" in
      2.2)
        AC_MSG_RESULT(2.2 family)
        AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
-       DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp"
+       DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
        ;;
 
      2.3)
        AC_MSG_RESULT(2.3 family)
        AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
-       DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.3.supp"
+       DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
        ;;
 
      2.4)
        AC_MSG_RESULT(2.4 family)
        AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
-       DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.4.supp"
+       DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
        ;;
 
      *)
@@ -317,8 +346,8 @@ esac
 # versions 3 and 4.
 AC_PATH_X
 if test "${no_x}" != 'yes' ; then
-   DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
-   DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
+   DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
+   DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
 fi
 
 
@@ -343,6 +372,27 @@ CFLAGS=$safe_CFLAGS
 AC_SUBST(FLAG_M32)
 
 
+# does this compiler support -m64 ?
+AC_MSG_CHECKING([if gcc accepts -m64])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-m64"
+
+AC_TRY_COMPILE(, [
+int main () { return 0 ; }
+],
+[
+FLAG_M64="-m64"
+AC_MSG_RESULT([yes])
+], [
+FLAG_M64=""
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+AC_SUBST(FLAG_M64)
+
+
 # does this compiler support -mmmx ?
 AC_MSG_CHECKING([if gcc accepts -mmmx])
 
@@ -557,9 +607,10 @@ AC_OUTPUT(
 
 cat<<EOF
 
-Using the following suppressions by default: 
+   Primary build target: ${VG_PLATFORM_PRI}
+       Secondary target: ${VG_PLATFORM_SEC}
+     Default supp files: ${DEFAULT_SUPP}
 
-      ${DEFAULT_SUPP}
 EOF
 
 cat<<EOF > default.supp
index 8846c9c7e90c49601f72f83f34745b099dd629ba..fd2df940180e8702934d268f1818d08d7d5b2864 100644 (file)
@@ -30,9 +30,24 @@ if VG_PPC64_LINUX
 noinst_LIBRARIES += libcoregrind_ppc64_linux.a libreplacemalloc_toolpreload_ppc64_linux.a
 endif
 
+#------------------------- launcher -----------------------
+# Build the launcher (valgrind) for the primary target only.
+#
 bin_PROGRAMS = \
        valgrind
 
+valgrind_SOURCES = \
+       launcher.c \
+       m_debuglog.c
+
+valgrind_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
+valgrind_CFLAGS    = $(AM_CFLAGS_PRI)
+valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
+valgrind_LDFLAGS   = $(AM_CFLAGS_PRI)
+#
+#----------------------------------------------------------
+
+
 noinst_PROGRAMS =
 if VG_X86_LINUX
 noinst_PROGRAMS += vgpreload_core-x86-linux.so
@@ -114,9 +129,6 @@ noinst_HEADERS = \
 BUILT_SOURCES = 
 CLEANFILES = 
 
-valgrind_SOURCES = \
-       launcher.c \
-       m_debuglog.c
 
 COREGRIND_SOURCES_COMMON = \
        m_commandline.c \
index 0f41e40b1509bdbd031f46d8cb001ac48feaf191..52a45321d1b7ca7209588c4defcebf233a243eba 100644 (file)
@@ -2,25 +2,63 @@
 Guide to multiple architecture support
 -------------------------------------------------------------------
 
-Valgrind supports systems where binaries for more than one architecture
-can be run and will allow all sorts of binaries to be run under valgrind.
+What is achieved
+~~~~~~~~~~~~~~~~
+Valgrind supports systems where binaries for more than one
+architecture can be run.  The current arrangements build:
 
-To support this the valgrind build system can now build multiple versions
-of the coregrind library and the VEX library and then build and link multiple
-versions of each tool.
+- single-arch support on x86 and ppc32 systems
+- dual-arch support on amd64 and ppc64 systems
 
-The configure script selects which architectures to build support for
-by defining a conditional for each platform that indicates whether or
-not support for that platform should be built. There are currently three
-such conditionals:
+To support this the valgrind build system can now build multiple
+versions of the coregrind library and of VEX, and then build and link
+multiple versions of each tool.
+
+A central notion is that of 'primary' vs 'secondary' platforms.  The
+system is built in its entirety for the primary platform, including
+performance and regression suites and all auxiliary programs.  For
+dual-arch systems, the primary platform is amd64 and ppc64
+respectively.
+
+On dual-arch systems, there is a 'secondary' target - x86 and ppc32 
+respectively.  The tools are built again for the secondary target, and
+the 'valgrind' launcher program can handle executables for either the 
+primary or secondary target.  However, the regression and performance
+tests and everything else is not rebuilt for the secondary target.
+
+On single-arch systems, there is no secondary target.
+
+
+How the build system does that
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The keys to understanding this are in:
+
+- configure.in
+- Makefile.flags.am
+- <tool>/tests/Makefile.am
+- <tool>/tests/<arch>/Makefile.am
+- perf/Makefile.am
+
+The configure script inspects the CPU.  It then sets
+
+   VG_PLATFORM_PRI to be the primary target
+   VG_PLATFORM_SEC to be the secondary target, if any
+
+(VG_PLATFORM_SEC is only used for printing an informational message at
+configure time).
+
+It also sets one (single-arch build) or two (dual-arch build) of
+the following:
 
   VG_X86_LINUX
   VG_AMD64_LINUX
   VG_PPC32_LINUX
+  VG_PPC64_LINUX
 
 On an amd64 system both VG_X86_LINUX and VG_AMD64_LINUX will be true
-so that two versions of all the tools will be built. The coregrind
-libraries will be named:
+so that two versions of all the tools will be built.  Similarly on a
+ppc64 system both VG_PPC32_LINUX and VG_PPC64_LINUX will be defined.
+For the amd64 example, the coregrind libraries will be named:
 
   libcoregrind_x86_linux.a
   libcoregrind_amd64_linux.a
@@ -67,12 +105,61 @@ installed in the appropriate place. On amd64 the result will be:
   <prefix>/lib/valgrind/xfree-4.supp
   <prefix>/lib/valgrind/glibc-2.2.supp
 
-The launcher program (ie the valgrind binary itself) is always
-built as a native program (so a 64 bit program on amd64) but will
-peek at the program which it is being asked to run and decide which
-of the possible tools to run taking both the requested tool and the
-format of the program being run into account.
+The launcher program (ie the valgrind binary itself) is always built
+as a program for the primary target (so a 64 bit program on amd64 and
+ppc64) but will peek at the program which it is being asked to run and
+decide which of the possible tools to run taking both the requested
+tool and the format of the program being run into account.
 
 Because the execv system call is now routed back through the launcher
 it is also possible to exec an x86 program from an amd64 program and
-vice versa.
+vice versa.  Ditto ppc32 and ppc64.
+
+
+Rules for Makefile.am hacking
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+In places where compilation should happen twice (on a dual-arch
+system), the decision about which directories and flags to use is
+guarded by the symbols:
+
+  VG_X86_LINUX
+  VG_AMD64_LINUX
+  VG_PPC32_LINUX
+  VG_PPC64_LINUX
+
+But there are also places where building must only happen once,
+for the primary architecture.  These places are (at least):
+
+* the launcher, valgrind.c
+* all the architecture-independent regression tests
+* the performance tests
+* optionally, auxilary programs like hp2ps and valgrind-listener
+
+In order to do that, we need to know what flags to use to build for
+the primary target, and in particular whether to hand -m32 or -m64 to
+gcc.  This is where Makefile.flags.am comes in.
+
+At the bottom of that file are defined AM_CPPFLAGS_PRI, AM_CFLAGS_PRI
+and AM_CCASFLAGS_PRI that must be used for compiling for the primary
+architecture.  For example, look in coregrind/Makefile.am, and you
+will see these flag-sets being used to build the launcher (valgrind).
+
+Also at the bottom of Makefile.flags.am, AM_FLAG_M3264_PRI is defined.
+This gives the -m32/-m64 flag needed to build for the primary target.
+That flag is also contained within AM_CFLAGS_PRI -- AM_FLAG_M3264_PRI
+merely facilitates getting hold of it without the surrounding gunk.
+
+This leads to the final complication: building the regression tests.
+Most of them are architecture-neutral and so should be built for the
+primary target.  The /test/ Makefile.am's duly include
+AM_FLAG_M3264_PRI in the compilation invokations, and you should
+ensure you preserve that when adding more tests.
+
+However, there are some arch-specific test directories (eg,
+none/tests/ppc32, etc).  In each of these, we implicitly 'know'
+whether -m32 or -m64 is the right thing to specify.  So instead of
+messing with AM_FLAG_M3264_PRI, these directories merely specific
+@FLAG_M32@ or @FLAG_M64@ directly.  (These two symbols are also
+automagically set up by configure.in.  Do not use -m32 and -m64
+directly - older compilers barf on them).
+
index 18fd0fed853d736e7673c9a13fa23f71da2b6724..23d676202e110b26df8bdde60eb45783da90707f 100644 (file)
@@ -1,3 +1,7 @@
+
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 noinst_SCRIPTS = filter_stderr
 
 EXTRA_DIST = $(noinst_SCRIPTS) \
@@ -13,5 +17,5 @@ check_PROGRAMS = \
        allok deadlock inherit race race2 readshared
 
 # force -gstabs, because we don't print symaddr for DWARF yet
-AM_CFLAGS      = $(WERROR) -Winline -Wall -Wshadow -gstabs
+AM_CFLAGS      = $(WERROR) -Winline -Wall -Wshadow -gstabs $(AM_FLAG_M3264_PRI)
 LDADD          = -lpthread
index b8d5d8e020cb9089091313681ffaa587b57b8c78..6c223d71c7c8690b4017cbd9d00586a0b80ce445 100644 (file)
@@ -1,4 +1,6 @@
+
 include $(top_srcdir)/Makefile.all.am
+include $(top_srcdir)/Makefile.flags.am
 
 AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -g
 
@@ -31,7 +33,13 @@ hp2ps_SOURCES = \
        Scale.c         \
        Shade.c         \
        Utilities.c
-hp2ps_LDADD = -lm
+
+# Build hp2ps for the primary target only.
+hp2ps_LDADD     = -lm
+hp2ps_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
+hp2ps_CFLAGS    = $(AM_CFLAGS_PRI)
+hp2ps_CCASFLAGS = $(AM_CCASFLAGS_PRI)
+hp2ps_LDFLAGS   = $(AM_CFLAGS_PRI)
 
 noinst_HEADERS = \
        AreaBelow.h \
index 025acc0dd21179140a6b4b76432280f2293cfaca..ea5ae33c788c789a1aa00fd4d959f755e6cf0e3b 100644 (file)
@@ -1,3 +1,7 @@
+
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 noinst_SCRIPTS = filter_stderr
 
 EXTRA_DIST = $(noinst_SCRIPTS) \
@@ -6,7 +10,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
         true_html.stderr.exp true_html.vgtest \
         true_text.stderr.exp true_text.vgtest
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g 
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 
 check_PROGRAMS = \
        basic_malloc
index 3f424fdb28a474a24d1583e3cf00a8fac5c802aa..b9cf4019e99339d6ef0b650adc283d2f38be2072 100644 (file)
@@ -1,3 +1,7 @@
+
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 SUBDIRS = .
 if VG_X86_LINUX
 SUBDIRS += x86
@@ -138,13 +142,16 @@ check_PROGRAMS = \
        writev zeropage
 
 
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/coregrind -I$(top_builddir)/include -I@VEX_DIR@/pub
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g 
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include \
+               -I$(top_srcdir)/coregrind -I$(top_builddir)/include \
+               -I@VEX_DIR@/pub
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 # Extra stuff for C tests
-memcmptest_CFLAGS      = $(AM_CFLAGS) -fno-builtin-memcmp
-oset_test_CFLAGS       = -DVGA_$(VG_ARCH) -DVGO_$(VG_OS) -DVGP_$(VG_PLATFORM)
+memcmptest_CFLAGS      = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -fno-builtin-memcmp
+oset_test_CFLAGS       = $(AM_FLAG_M3264_PRI) \
+                               -DVGA_$(VG_ARCH) -DVGO_$(VG_OS) -DVGP_$(VG_PLATFORM)
 # Don't allow GCC to inline memcpy(), because then we can't intercept it
 overlap_CFLAGS         = $(AM_CFLAGS) -fno-builtin-memcpy
 stack_switch_LDADD      = -lpthread
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..123b3a991641ab45f0dd304db8c05c6aaf7aaad2 100644 (file)
@@ -0,0 +1,3 @@
+
+# if any tests appear here, remember to include @FLAG_M32@ in the
+# compilation flags
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..237719404dad35232e7e8f4420d0efdf63544c6e 100644 (file)
@@ -0,0 +1,3 @@
+
+# if any tests appear here, remember to include @FLAG_M64@ in the
+# compilation flags
index 9668140c30f8e41d0fe3658ef930f1939165c8a8..b68f9ce19cc052378bc8bc4f828ddacfc1b327cf 100644 (file)
@@ -1,3 +1,7 @@
+
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 SUBDIRS = .
 if VG_X86_LINUX
 SUBDIRS += x86
@@ -145,12 +149,12 @@ check_PROGRAMS = \
        tls tls.so tls2.so vgprintf \
        coolo_sigaction gxx304
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/include
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 # Extra stuff for C tests
-ansi_CFLAGS            = -ansi
+ansi_CFLAGS            = $(AM_FLAG_M3264_PRI) -ansi
 floored_LDADD          = -lm
 manythreads_LDADD      = -lpthread
 mq_LDADD               = -lrt
@@ -180,7 +184,7 @@ tls_so_SOURCES              = tls_so.c
 tls_so_LDADD           = tls2.so
 tls_so_DEPENDENCIES    = tls2.so
 tls_so_LDFLAGS         = -Wl,-rpath,$(top_builddir)/none/tests -shared -fPIC
-tls_so_CFLAGS          = -fPIC
+tls_so_CFLAGS          = $(AM_FLAG_M3264_PRI) -fPIC
 tls2_so_SOURCES                = tls2_so.c
 tls2_so_LDFLAGS                = -shared
 
index 23314d90ce3e59c455a35a621bef47dc8f57bad7..b7335a7c10509a5acc7e41cbff1f79cc4688339e 100644 (file)
@@ -11,8 +11,11 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
 check_PROGRAMS = \
        lsw jm-insns testVMX
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include
-AM_CXXFLAGS = $(AM_CFLAGS)
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
+               @FLAG_M32@
+AM_CXXFLAGS = $(AM_CFLAGS) @FLAG_M32@
 
-jm_insns_CFLAGS = -Winline -Wall -O -mregnames -DHAS_ALTIVEC -maltivec 
-testVMX_CFLAGS  = -O -g -Wall -maltivec -mabi=altivec -DALTIVEC -DGCC_COMPILER
+jm_insns_CFLAGS = -Winline -Wall -O -mregnames \
+                       -DHAS_ALTIVEC -maltivec @FLAG_M32@
+testVMX_CFLAGS  = -O -g -Wall -maltivec -mabi=altivec -DALTIVEC \
+                       -DGCC_COMPILER @FLAG_M32@
index 29ef78d7482d6d9390b5db0d02442aac5bd6491a..792a1afe81b1910b4bf365a8d8f733926932418d 100644 (file)
@@ -9,8 +9,9 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
 check_PROGRAMS = \
        jm-insns
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include
-AM_CXXFLAGS = $(AM_CFLAGS)
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
+               @FLAG_M64@
+AM_CXXFLAGS = $(AM_CFLAGS) @FLAG_M64@
 
-jm_insns_CFLAGS = -Winline -Wall -O -mregnames -DHAS_ALTIVEC -maltivec -m64 
-jm_insns_LDFLAGS = -m64
+jm_insns_CFLAGS = -Winline -Wall -O -mregnames -DHAS_ALTIVEC -maltivec \
+                       @FLAG_M64@
index ba8d3225d49a28cd2dc9d3aac8eb9460acc3bb48..669de45b2ea111bf07773dca0e6dba100fe97b1c 100644 (file)
@@ -1,4 +1,7 @@
 
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 noinst_SCRIPTS = vg_perf
 
 noinst_HEADERS = stdarg.h stddef.h
@@ -16,11 +19,11 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
 check_PROGRAMS = \
        bigcode bz2 fbench ffbench heap sarp tinycc
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -O
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -O $(AM_FLAG_M3264_PRI)
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/include
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 # Extra stuff
-fbench_CFLAGS   = -g -O2
+fbench_CFLAGS   = $(AM_FLAG_M3264_PRI) -g -O2
 fbench_LDADD   = 
 ffbench_LDADD  = -lm
index 4b2e2f5a5ddf0614d9ee861d64795ce06c6399c7..0cc96e1ea572af58f758f02b12c8a670abb1b529 100644 (file)
@@ -1,4 +1,7 @@
 
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
 noinst_SCRIPTS = \
        vg_regtest \
        filter_addresses \
@@ -16,7 +19,7 @@ check_PROGRAMS = \
        toobig-allocs \
        true
 
-AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 # generic C ones