|
From: Greg P. <gp...@us...> - 2005-11-04 20:53:50
|
The following patches modify configure.in and Makefile.core.am
for Darwin. The changes are:
* make selection of valt_load_address and some CFLAGS be
platform-based instead of CPU-based
* add ppc32-darwin and x86-darwin to the recognized OSes and platforms
* move -Wa,-gstabs from Makefile.core.am to configure.in because it
doesn't work on Darwin
* skip the glibc version check on Darwin, which doesn't use glibc
* add HAVE_PROC config which checks for /proc/self/[fd,exe,maps],
which don't exist on Darwin
* add HAVE_MREMAP config which checks for mremap(), which doesn't
exist on Darwin
* add #defines VG_ARCH, VG_OS, and VG_PLATFORM which have the
obvious values.
My autoconf-fu isn't great, but I think these changes are clean.
You might want to disallow configure of OS=darwin because it
of course doesn't actually work.
--- .svn/text-base/Makefile.core.am.svn-base 2005-11-02 21:42:17.000000000 -0800
+++ Makefile.core.am 2005-11-02 22:27:18.000000000 -0800
@@ -5,6 +5,9 @@
-I$(top_srcdir)/coregrind/$(VG_PLATFORM) \
-I$(top_srcdir)/include \
-I@VEX_DIR@/pub \
+ -DVG_ARCH=$(VG_ARCH) \
+ -DVG_OS=$(VG_OS) \
+ -DVG_PLATFORM=$(VG_ARCH)_$(VG_OS) \
-DVGA_$(VG_ARCH)=1 \
-DVGO_$(VG_OS)=1 \
-DVGP_$(VG_ARCH)_$(VG_OS)=1
@@ -15,5 +18,5 @@
AM_CPPFLAGS = $(add_includes)
AM_CFLAGS = $(WERROR) $(BASE_AM_CFLAGS)
-AM_CCASFLAGS = $(add_includes) @ARCH_CORE_AM_CCASFLAGS@ -Wa,-gstabs
+AM_CCASFLAGS = $(add_includes) @ARCH_CORE_AM_CCASFLAGS@
--- .svn/text-base/configure.in.svn-base 2005-11-02 21:42:16.000000000 -0800
+++ configure.in 2005-11-04 00:32:06.000000000 -0800
@@ -111,49 +111,21 @@
AC_SUBST(VG_ARCH)
AC_SUBST(VG_ARCH_ALL)
VG_ARCH_ALL="amd64 ppc32 x86"
-AC_SUBST(VALT_LOAD_ADDRESS)
-AC_SUBST(ARCH_CORE_AM_CFLAGS)
-AC_SUBST(ARCH_TOOL_AM_CFLAGS)
-AC_SUBST(ARCH_CORE_AM_CCASFLAGS)
case "${host_cpu}" in
i?86)
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH="x86"
- valt_load_address_normal="0xb0000000"
- valt_load_address_inner="0xa0000000"
- ARCH_CORE_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
- ARCH_TOOL_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
- ARCH_CORE_AM_CCASFLAGS="@FLAG_M32@"
;;
x86_64)
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH="amd64"
- # XXX: relocations under amd64's "small model" are 32-bit signed
- # quantities; therefore going above 0x7fffffff doesn't work... this is
- # a problem.
- valt_load_address_normal="0x70000000"
- valt_load_address_inner="0x60000000"
- ARCH_CORE_AM_CFLAGS="-m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@"
- # XXX: need to use -fpic, otherwise when linking tools I get this error
- # message:
- # relocation R_X86_64_32 can not be used when making a shared object;
- # recompile with -fPIC
- #
- # I don't understand... --njn
- ARCH_TOOL_AM_CFLAGS="-m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -fpic"
- ARCH_CORE_AM_CCASFLAGS="-m64"
;;
powerpc*)
AC_MSG_RESULT([ok (${host_cpu})])
VG_ARCH="ppc32"
- valt_load_address_normal="0x70000000"
- valt_load_address_inner="0x60000000"
- ARCH_CORE_AM_CFLAGS=""
- ARCH_TOOL_AM_CFLAGS="-fpic"
- ARCH_CORE_AM_CCASFLAGS="-Wa,-maltivec"
;;
*)
@@ -162,23 +134,10 @@
;;
esac
-# Check if this should be built as an inner Valgrind, to be run within
-# another Valgrind. Choose the load address accordingly.
-AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner,
- [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting],
- [vg_cv_inner=$enableval],
- [vg_cv_inner=no])])
-if test "$vg_cv_inner" = yes; then
- AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
- VALT_LOAD_ADDRESS=$valt_load_address_inner
-else
- VALT_LOAD_ADDRESS=$valt_load_address_normal
-fi
-
AC_MSG_CHECKING([for a supported OS])
AC_SUBST(VG_OS)
AC_SUBST(VG_OS_ALL)
-VG_OS_ALL="linux"
+VG_OS_ALL="linux darwin"
case "${host_os}" in
*linux*)
@@ -214,6 +173,11 @@
VG_OS="freebsd"
;;
+ *darwin*)
+ AC_MSG_RESULT([ok (${host_os})])
+ VG_OS="darwin"
+ ;;
+
*)
AC_MSG_RESULT([no (${host_os})])
AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
@@ -223,21 +187,90 @@
AC_MSG_CHECKING([for a supported CPU/OS combination])
AC_SUBST(VG_PLATFORM)
AC_SUBST(VG_PLATFORM_ALL)
-VG_PLATFORM_ALL="amd64-linux ppc32-linux x86-linux"
+AC_SUBST(VALT_LOAD_ADDRESS)
+AC_SUBST(ARCH_CORE_AM_CFLAGS)
+AC_SUBST(ARCH_TOOL_AM_CFLAGS)
+AC_SUBST(ARCH_CORE_AM_CCASFLAGS)
+
+VG_PLATFORM_ALL="amd64-linux ppc32-linux x86-linux ppc32-darwin x86-darwin"
VG_PLATFORM="$VG_ARCH-$VG_OS"
case $VG_PLATFORM in
- x86-linux|amd64-linux|ppc32-linux)
+ x86-linux)
AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
+ valt_load_address_normal="0xb0000000"
+ valt_load_address_inner="0xa0000000"
+ ARCH_CORE_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
+ ARCH_TOOL_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@"
+ ARCH_CORE_AM_CCASFLAGS="@FLAG_M32@ -Wa,-gstabs"
;;
+ amd64-linux)
+ AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
+ # XXX: relocations under amd64's "small model" are 32-bit signed
+ # quantities; therefore going above 0x7fffffff doesn't work... this is
+ # a problem.
+ valt_load_address_normal="0x70000000"
+ valt_load_address_inner="0x60000000"
+ ARCH_CORE_AM_CFLAGS="-m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@"
+ # XXX: need to use -fpic, otherwise when linking tools I get this error
+ # message:
+ # relocation R_X86_64_32 can not be used when making a shared object;
+ # recompile with -fPIC
+ #
+ # I don't understand... --njn
+ ARCH_TOOL_AM_CFLAGS="-m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -fpic"
+ ARCH_CORE_AM_CCASFLAGS="-m64 -Wa,-gstabs"
+ ;;
+
+ ppc32-linux)
+ AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
+ valt_load_address_normal="0x70000000"
+ valt_load_address_inner="0x60000000"
+ ARCH_CORE_AM_CFLAGS=""
+ ARCH_TOOL_AM_CFLAGS="-fpic"
+ ARCH_CORE_AM_CCASFLAGS="-Wa,-maltivec -Wa,-gstabs"
+ ;;
+
+ ppc32-darwin)
+ AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
+ valt_load_address_normal="0x70000000"
+ valt_load_address_inner="0x60000000"
+ ARCH_CORE_AM_CFLAGS="-mdynamic-no-pic"
+ ARCH_TOOL_AM_CFLAGS="-mdynamic-no-pic"
+ ARCH_CORE_AM_CCASFLAGS="-maltivec -force_cpusubtype_ALL"
+ ;;
+
+ x86-darwin)
+ AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
+ valt_load_address_normal="0x70000000"
+ valt_load_address_inner="0x60000000"
+ ARCH_CORE_AM_CFLAGS="-mdynamic-no-pic"
+ ARCH_TOOL_AM_CFLAGS="-mdynamic-no-pic"
+ ARCH_CORE_AM_CCASFLAGS=""
+ ;;
+
*)
AC_MSG_RESULT([no (${host_cpu}-${host_os})])
AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
;;
esac
+# Check if this should be built as an inner Valgrind, to be run within
+# another Valgrind. Choose the load address accordingly.
+AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner,
+ [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting],
+ [vg_cv_inner=$enableval],
+ [vg_cv_inner=no])])
+if test "$vg_cv_inner" = yes; then
+ AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
+ VALT_LOAD_ADDRESS=$valt_load_address_inner
+else
+ VALT_LOAD_ADDRESS=$valt_load_address_normal
+fi
+
+
AC_SUBST(DEFAULT_SUPP)
glibc=""
@@ -294,8 +327,15 @@
;;
*)
- AC_MSG_RESULT(unsupported version)
- AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4])
+ case "${VG_OS}" in
+ darwin)
+ AC_MSG_RESULT(not needed)
+ ;;
+ *)
+ AC_MSG_RESULT(unsupported version)
+ AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4])
+ ;;
+ esac
;;
esac
@@ -455,6 +495,12 @@
fi
+# Check for /proc filesystem
+AC_CHECK_FILES(/proc/self/fd /proc/self/exe /proc/self/maps,
+ [ AC_DEFINE([HAVE_PROC], 1, [can use /proc filesystem]) ],
+ [])
+
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
@@ -472,7 +518,7 @@
AC_FUNC_MMAP
AC_TYPE_SIGNAL
-AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
+AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop mremap])
AC_OUTPUT(
Makefile
|
|
From: Tom H. <to...@co...> - 2005-11-07 19:10:51
|
In message <200...@ka...>
Greg Parker <gp...@us...> wrote:
> The following patches modify configure.in and Makefile.core.am
> for Darwin. The changes are:
>
> * make selection of valt_load_address and some CFLAGS be
> platform-based instead of CPU-based
> * add ppc32-darwin and x86-darwin to the recognized OSes and platforms
> * move -Wa,-gstabs from Makefile.core.am to configure.in because it
> doesn't work on Darwin
> * skip the glibc version check on Darwin, which doesn't use glibc
> * add HAVE_PROC config which checks for /proc/self/[fd,exe,maps],
> which don't exist on Darwin
> * add HAVE_MREMAP config which checks for mremap(), which doesn't
> exist on Darwin
> * add #defines VG_ARCH, VG_OS, and VG_PLATFORM which have the
> obvious values.
>
> My autoconf-fu isn't great, but I think these changes are clean.
> You might want to disallow configure of OS=darwin because it
> of course doesn't actually work.
Unfortunately the biarch patch that I just committed changes quite
a bit of the build system so a number of these changes aren't going
to apply any more.
The new build system does arrange for a VG_PLATFORM define though
which might be helpful.
I have also removed the -Wa,-gstabs in favour of a simple -g so that
the compiler provides an appropriate switch to the assembler which
means we'll now get DWARF on x86-linux and amd64-linux at least with
recent compilers.
The CFLAGS are now also defined on a per platform basis in the
top level Makefile.flags.am file.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|