|
From: <sv...@va...> - 2008-09-19 02:02:11
|
Author: sewardj
Date: 2008-09-19 10:02:19 +0100 (Fri, 19 Sep 2008)
New Revision: 8623
Log:
Fix longstanding bug in dual-arch support, which originated in
memcheck/tests/Makefile.am and was copied into drd/tests/Makefile.am.
When building regtests for a 32-bit only build on a 64-bit CPU, the
use of $(VG_ARCH) in these Makefiles is incorrect, because VG_ARCH
will be set to the 64-bit architecture, not the 32-bit architecture.
See comments on VG_ARCH_PRI and VG_ARCH_MAX in configure.in for more
details.
Modified:
trunk/configure.in
trunk/docs/internals/multiple-architectures.txt
trunk/drd/tests/Makefile.am
trunk/memcheck/tests/Makefile.am
trunk/none/tests/x86/Makefile.am
trunk/tests/Makefile.am
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2008-09-18 18:37:30 UTC (rev 8622)
+++ trunk/configure.in 2008-09-19 09:02:19 UTC (rev 8623)
@@ -126,15 +126,22 @@
esac
-# Checks for the platform, with the aim of setting VG_ARCH. Note
-# that VG_ARCH must be set to reflect 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.
+# Checks for the platform, with the aim of setting VG_ARCH_MAX. Note
+# that VG_ARCH_MAX must be set to reflect 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.
+#
+# We will later in this file set VG_ARCH_PRI, which is the arch for
+# the primary target. For example, suppose we do a build on an amd64
+# machine, but --enable-only32bit has been requested. Then
+# VG_ARCH_MAX will be "amd64" since that reflects the most that this
+# cpu can do, but VG_ARCH_PRI will be "x86", since that reflects the
+# arch corresponding to the primary build (VG_PLATFORM_PRI).
AC_CANONICAL_HOST
AC_MSG_CHECKING([for a supported CPU])
-AC_SUBST(VG_ARCH)
+AC_SUBST(VG_ARCH_MAX)
AC_SUBST(VG_ARCH_ALL)
VG_ARCH_ALL="amd64 ppc32 ppc64 x86"
@@ -144,14 +151,14 @@
case "${host_cpu}" in
i?86)
AC_MSG_RESULT([ok (${host_cpu})])
- VG_ARCH="x86"
+ VG_ARCH_MAX="x86"
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
;;
x86_64)
AC_MSG_RESULT([ok (${host_cpu})])
- VG_ARCH="amd64"
+ VG_ARCH_MAX="amd64"
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
;;
@@ -159,7 +166,7 @@
powerpc64)
# This value can only happen on Linux, not on AIX
AC_MSG_RESULT([ok (${host_cpu})])
- VG_ARCH="ppc64"
+ VG_ARCH_MAX="ppc64"
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
;;
@@ -170,10 +177,10 @@
AC_MSG_RESULT([ok (${host_cpu})])
case "${host_os}" in
aix5.*)
- VG_ARCH="ppc64"
+ VG_ARCH_MAX="ppc64"
;;
*)
- VG_ARCH="ppc32"
+ VG_ARCH_MAX="ppc32"
;;
esac
valt_load_address_normal="0x38000000"
@@ -287,7 +294,7 @@
# supports building 32 bit programs and disable 32 bit support if it
# does not support building 32 bit programs
-case "$VG_ARCH-$VG_OS" in
+case "$VG_ARCH_MAX-$VG_OS" in
amd64-linux|ppc64-linux)
AC_MSG_CHECKING([for 32 bit build support])
safe_CFLAGS=$CFLAGS
@@ -317,12 +324,23 @@
# possible. The system will also be built for this target, but not
# the regression or performance tests.
#
+# Also establish VG_ARCH_PRI, which is the arch for the primary
+# build target. The various makefiles building regression tests
+# sometimes need to see this.
AC_MSG_CHECKING([for a supported CPU/OS combination])
AC_SUBST(VG_PLATFORM_PRI)
AC_SUBST(VG_PLATFORM_SEC)
+AC_SUBST(VG_ARCH_PRI)
-case "$VG_ARCH-$VG_OS" in
+# By default, the primary arch is the same as the "max" arch, as
+# commented above (at the definition of VG_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.
+VG_ARCH_PRI=$VG_ARCH_MAX
+
+case "$VG_ARCH_MAX-$VG_OS" in
x86-linux)
VG_PLATFORM_PRI="X86_LINUX"
VG_PLATFORM_SEC=""
@@ -335,6 +353,7 @@
elif test x$vg_cv_only32bit = xyes; then
VG_PLATFORM_PRI="X86_LINUX"
VG_PLATFORM_SEC=""
+ VG_ARCH_PRI="x86"
else
VG_PLATFORM_PRI="AMD64_LINUX"
VG_PLATFORM_SEC="X86_LINUX"
@@ -353,6 +372,7 @@
elif test x$vg_cv_only32bit = xyes; then
VG_PLATFORM_PRI="PPC32_AIX5"
VG_PLATFORM_SEC=""
+ VG_ARCH_PRI="ppc32"
else
VG_PLATFORM_PRI="PPC64_AIX5"
VG_PLATFORM_SEC="PPC32_AIX5"
@@ -366,6 +386,7 @@
elif test x$vg_cv_only32bit = xyes; then
VG_PLATFORM_PRI="PPC32_LINUX"
VG_PLATFORM_SEC=""
+ VG_ARCH_PRI="ppc32"
else
VG_PLATFORM_PRI="PPC64_LINUX"
VG_PLATFORM_SEC="PPC32_LINUX"
@@ -1529,10 +1550,13 @@
cat<<EOF
- Primary build target: ${VG_PLATFORM_PRI}
- Secondary build target: ${VG_PLATFORM_SEC}
- Default supp files: ${DEFAULT_SUPP}
+ configure.in: VG_ARCH_MAX = ${VG_ARCH_MAX}
+ configure.in: VG_ARCH_PRI = ${VG_ARCH_PRI}
+ Primary build target: ${VG_PLATFORM_PRI}
+ Secondary build target: ${VG_PLATFORM_SEC}
+ Default supp files: ${DEFAULT_SUPP}
+
EOF
cat<<EOF > default.supp
Modified: trunk/docs/internals/multiple-architectures.txt
===================================================================
--- trunk/docs/internals/multiple-architectures.txt 2008-09-18 18:37:30 UTC (rev 8622)
+++ trunk/docs/internals/multiple-architectures.txt 2008-09-19 09:02:19 UTC (rev 8623)
@@ -158,5 +158,7 @@
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).
-
+directly - older compilers barf on them). Another reason not to
+use -m32 and -m64 directly is that they are called -maix32 and
+-maix64 on AIX; once again this is taken care of properly if you
+use @FLAG_M32@ and @FLAG_M64@ instead.
Modified: trunk/drd/tests/Makefile.am
===================================================================
--- trunk/drd/tests/Makefile.am 2008-09-18 18:37:30 UTC (rev 8622)
+++ trunk/drd/tests/Makefile.am 2008-09-19 09:02:19 UTC (rev 8623)
@@ -179,8 +179,8 @@
trylock.vgtest
AM_CFLAGS = $(WERROR) -Wall @FLAG_W_EXTRA@ -Wno-inline -Wno-unused-parameter\
- -g $(AM_FLAG_M3264_PRI) -DVGA_$(VG_ARCH)=1 -DVGO_$(VG_OS)=1 \
- -DVGP_$(VG_ARCH)_$(VG_OS)=1
+ -g $(AM_FLAG_M3264_PRI) -DVGA_$(VG_ARCH_PRI)=1 -DVGO_$(VG_OS)=1 \
+ -DVGP_$(VG_ARCH_PRI)_$(VG_OS)=1
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include \
-I$(top_builddir)/include -I$(top_srcdir)/VEX/pub
AM_CXXFLAGS = $(AM_CFLAGS)
Modified: trunk/memcheck/tests/Makefile.am
===================================================================
--- trunk/memcheck/tests/Makefile.am 2008-09-18 18:37:30 UTC (rev 8622)
+++ trunk/memcheck/tests/Makefile.am 2008-09-19 09:02:19 UTC (rev 8623)
@@ -236,8 +236,8 @@
# Extra stuff for C tests
memcmptest_CFLAGS = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -fno-builtin-memcmp
oset_test_CFLAGS = $(AM_FLAG_M3264_PRI) \
- -DVGA_$(VG_ARCH)=1 -DVGO_$(VG_OS)=1 \
- -DVGP_$(VG_ARCH)_$(VG_OS)=1
+ -DVGA_$(VG_ARCH_PRI)=1 -DVGO_$(VG_OS)=1 \
+ -DVGP_$(VG_ARCH_PRI)_$(VG_OS)=1
linux_timerfd_syscall_LDADD = -lrt
vcpu_bz2_CFLAGS = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -O2 -g
vcpu_fbench_CFLAGS = $(AM_FLAG_M3264_PRI) $(AM_CFLAGS) -O2 -g
@@ -363,6 +363,6 @@
#hello_DEPENDENCIES = $(top_builddir)/valt_load_address.lds
# vgtest_ume is not working
-#vgtest_ume_CFLAGS = -DVGA_$(VG_ARCH) -DVGO_$(VG_OS)
+#vgtest_ume_CFLAGS = -DVGA_$(VG_ARCH_PRI) -DVGO_$(VG_OS)
#vgtest_ume_LDADD = ../../coregrind/m_ume.o
Modified: trunk/none/tests/x86/Makefile.am
===================================================================
--- trunk/none/tests/x86/Makefile.am 2008-09-18 18:37:30 UTC (rev 8622)
+++ trunk/none/tests/x86/Makefile.am 2008-09-19 09:02:19 UTC (rev 8623)
@@ -100,7 +100,7 @@
insn_sse2_LDADD = -lm
insn_sse3_SOURCES = insn_sse3.def
insn_sse3_LDADD = -lm
-yield_CFLAGS = $(AM_CFLAGS) -D__$(VG_ARCH)__
+yield_CFLAGS = $(AM_CFLAGS) -D__$(VG_ARCH_MAX)__
yield_LDADD = -lpthread
.def.c: $(srcdir)/gen_insn_test.pl
Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am 2008-09-18 18:37:30 UTC (rev 8622)
+++ trunk/tests/Makefile.am 2008-09-19 09:02:19 UTC (rev 8623)
@@ -24,7 +24,7 @@
# generic C ones
cputest_SOURCES = cputest.c
-cputest_CFLAGS = $(AM_CFLAGS) -D__$(VG_ARCH)__
+cputest_CFLAGS = $(AM_CFLAGS) -D__$(VG_ARCH_MAX)__
cputest_DEPENDENCIES =
cputest_LDADD =
toobig_allocs_SOURCES = toobig-allocs.c
|