From: Julian Seward Date: Wed, 4 Jan 2006 01:20:28 +0000 (+0000) Subject: Somewhat rehash the biarch-build machinery so as to (1) formalise the X-Git-Tag: svn/VALGRIND_3_2_0~407 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32f134b8c19efe7d5deca1853336dceb0d255619;p=thirdparty%2Fvalgrind.git Somewhat rehash the biarch-build machinery so as to (1) formalise the 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 /tests/{amd64,x86}/Makefile.am are fixed up (shortly). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5493 --- diff --git a/Makefile.flags.am b/Makefile.flags.am index 1d4555ec86..5af69c4713 100644 --- a/Makefile.flags.am +++ b/Makefile.flags.am @@ -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@) diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index abaf6aa170..85cc0cd1d9 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -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) +# +#---------------------------------------------------------- + + diff --git a/cachegrind/tests/Makefile.am b/cachegrind/tests/Makefile.am index aee2531ef6..15c35060b6 100644 --- a/cachegrind/tests/Makefile.am +++ b/cachegrind/tests/Makefile.am @@ -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 diff --git a/cachegrind/tests/ppc32/Makefile.am b/cachegrind/tests/ppc32/Makefile.am index e69de29bb2..123b3a9916 100644 --- a/cachegrind/tests/ppc32/Makefile.am +++ b/cachegrind/tests/ppc32/Makefile.am @@ -0,0 +1,3 @@ + +# if any tests appear here, remember to include @FLAG_M32@ in the +# compilation flags diff --git a/cachegrind/tests/ppc64/Makefile.am b/cachegrind/tests/ppc64/Makefile.am index e69de29bb2..237719404d 100644 --- a/cachegrind/tests/ppc64/Makefile.am +++ b/cachegrind/tests/ppc64/Makefile.am @@ -0,0 +1,3 @@ + +# if any tests appear here, remember to include @FLAG_M64@ in the +# compilation flags diff --git a/configure.in b/configure.in index 6802595789..a157ac6e1e 100644 --- a/configure.in +++ b/configure.in @@ -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_. 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< default.supp diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 8846c9c7e9..fd2df94018 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -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 \ diff --git a/docs/internals/multiple-architectures.txt b/docs/internals/multiple-architectures.txt index 0f41e40b15..52a45321d1 100644 --- a/docs/internals/multiple-architectures.txt +++ b/docs/internals/multiple-architectures.txt @@ -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 +- /tests/Makefile.am +- /tests//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: /lib/valgrind/xfree-4.supp /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). + diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 18fd0fed85..23d676202e 100644 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -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 diff --git a/massif/hp2ps/Makefile.am b/massif/hp2ps/Makefile.am index b8d5d8e020..6c223d71c7 100644 --- a/massif/hp2ps/Makefile.am +++ b/massif/hp2ps/Makefile.am @@ -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 \ diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am index 025acc0dd2..ea5ae33c78 100644 --- a/massif/tests/Makefile.am +++ b/massif/tests/Makefile.am @@ -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 diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 3f424fdb28..b9cf4019e9 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -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 diff --git a/memcheck/tests/ppc32/Makefile.am b/memcheck/tests/ppc32/Makefile.am index e69de29bb2..123b3a9916 100644 --- a/memcheck/tests/ppc32/Makefile.am +++ b/memcheck/tests/ppc32/Makefile.am @@ -0,0 +1,3 @@ + +# if any tests appear here, remember to include @FLAG_M32@ in the +# compilation flags diff --git a/memcheck/tests/ppc64/Makefile.am b/memcheck/tests/ppc64/Makefile.am index e69de29bb2..237719404d 100644 --- a/memcheck/tests/ppc64/Makefile.am +++ b/memcheck/tests/ppc64/Makefile.am @@ -0,0 +1,3 @@ + +# if any tests appear here, remember to include @FLAG_M64@ in the +# compilation flags diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 9668140c30..b68f9ce19c 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -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 diff --git a/none/tests/ppc32/Makefile.am b/none/tests/ppc32/Makefile.am index 23314d90ce..b7335a7c10 100644 --- a/none/tests/ppc32/Makefile.am +++ b/none/tests/ppc32/Makefile.am @@ -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@ diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am index 29ef78d748..792a1afe81 100644 --- a/none/tests/ppc64/Makefile.am +++ b/none/tests/ppc64/Makefile.am @@ -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@ diff --git a/perf/Makefile.am b/perf/Makefile.am index ba8d3225d4..669de45b2e 100644 --- a/perf/Makefile.am +++ b/perf/Makefile.am @@ -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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 4b2e2f5a5d..0cc96e1ea5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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