Added beginnings of an AMD64 port, so lots of new files and directories.
It compiles, but aborts immediately if you try to run it.

I didn't include ldt.c;  I'm not sure how the LDT is used on AMD64.  It can be
added later if necessary.

While doing this, did some 64-bit cleanness fixes:
- Added necessary intermediate casts to ULong to avoid warnings when converting
  ThreadId to void* and vice versa, in vg_scheduler.c.
- Fixed VALGRIND_NON_SIMD_CALL[0123] to use 'long' as the return type.
- Fixed VALGRIND_PRINTF{,BACKTRACE} to use unsigned longs instead of unsigned
  ints, as needed.
- Converted some offsets in vg_symtab2.h from "Int" to "OffT".
- Made strlen, strncat, etc, use SizeT instead of 'unsigned int' for the length
  parameter.
- Couple of other minor things.

I had to insert some "#ifdef __amd64__" and "#ifndef __amd64__" guards in
places.  In particular, in vg_mylibc.c, some of our syscall wrappers aren't
appropriate for AMD64 because the syscall numbering is a bit different in
places.  This difference will have to be abstracted out somehow.

Also rewrote the sys_fcntl and sys_fcntl64 wrappers, as required for AMD64.

Also moved the ipc wrapper into x86, since it's not applicable for
AMD64.  However, it is applicable (I think) for ARM, so it would be nice
to work out a way to share syscall wrappers between some, but not all,
archs.  Hmm.  Also now using the real IPC constants rather than magic
numbers in the wrapper.

Other non-AMD64-related fixes:
- ARM: fixed syscall table by accounting for the fact that syscall
  numbers don't start at 0, but rather at 0x900000.
- Converted a few places to use ThreadId instead of 'int' or 'Int' for
  thread IDs.
- Added both AMD64 and ARM (which I'd forgotten) entries to valgrind.spec.in.
- Tweaked comments in various places.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3136 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index 237304a..437dcc3 100644
--- a/configure.in
+++ b/configure.in
@@ -85,7 +85,7 @@
 AC_MSG_CHECKING([for a supported CPU])
 AC_SUBST(VG_ARCH)
 AC_SUBST(VG_ARCH_ALL)
-VG_ARCH_ALL="arm x86"
+VG_ARCH_ALL="amd64 arm x86"
 AC_SUBST(KICKSTART_BASE)
 AC_SUBST(ARCH_CORE_AM_CFLAGS)
 AC_SUBST(ARCH_TOOL_AM_CFLAGS)
@@ -104,12 +104,18 @@
      x86_64) 
         AC_MSG_RESULT([ok (${host_cpu})])
         VG_ARCH="amd64"
-        # OOO: relocations under x86-64 small model are 32-bit signed
+        # XXX: relocations under amd64's "small model" are 32-bit signed
         # quantities; therefore going above 0x7fffffff doesn't work... this is
         # a problem.
         KICKSTART_BASE="0x70000000"
         ARCH_CORE_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -DELFSZ=64" 
-        ARCH_TOOL_AM_CFLAGS="-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="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -fpic"
         ARCH_CORE_AM_CCASFLAGS=""
         ;;
 
@@ -186,7 +192,7 @@
 AC_MSG_CHECKING([for a supported CPU/OS combination])
 AC_SUBST(VG_PLATFORM)
 AC_SUBST(VG_PLATFORM_ALL)
-VG_PLATFORM_ALL="arm-linux x86-linux"
+VG_PLATFORM_ALL="amd64-linux arm-linux x86-linux"
 
 VG_PLATFORM="$VG_ARCH-$VG_OS"
 
@@ -355,34 +361,41 @@
    tests/unused/Makefile 
    include/valgrind.h 
    include/Makefile 
-   include/x86/Makefile 
+   include/amd64/Makefile 
    include/arm/Makefile 
+   include/x86/Makefile 
    include/linux/Makefile 
-   include/x86-linux/Makefile 
+   include/amd64-linux/Makefile 
    include/arm-linux/Makefile 
+   include/x86-linux/Makefile 
    auxprogs/Makefile
    coregrind/Makefile 
    coregrind/demangle/Makefile 
    coregrind/docs/Makefile
-   coregrind/x86/Makefile
+   coregrind/amd64/Makefile
    coregrind/arm/Makefile
+   coregrind/x86/Makefile
    coregrind/linux/Makefile
-   coregrind/x86-linux/Makefile
+   coregrind/amd64-linux/Makefile
    coregrind/arm-linux/Makefile
+   coregrind/x86-linux/Makefile
    addrcheck/Makefile
    addrcheck/tests/Makefile
    addrcheck/docs/Makefile
    memcheck/Makefile
    memcheck/tests/Makefile
-   memcheck/tests/x86/Makefile
+   memcheck/tests/amd64/Makefile
    memcheck/tests/arm/Makefile
+   memcheck/tests/x86/Makefile
    memcheck/docs/Makefile
    cachegrind/Makefile
-   cachegrind/x86/Makefile
+   cachegrind/amd64/Makefile
    cachegrind/arm/Makefile
+   cachegrind/x86/Makefile
    cachegrind/tests/Makefile
-   cachegrind/tests/x86/Makefile
+   cachegrind/tests/amd64/Makefile
    cachegrind/tests/arm/Makefile
+   cachegrind/tests/x86/Makefile
    cachegrind/docs/Makefile
    cachegrind/cg_annotate
    helgrind/Makefile
@@ -400,8 +413,9 @@
    lackey/docs/Makefile
    none/Makefile
    none/tests/Makefile
-   none/tests/x86/Makefile
+   none/tests/amd64/Makefile
    none/tests/arm/Makefile
+   none/tests/x86/Makefile
    none/docs/Makefile
 )