All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64
@ 2013-03-15 13:15 Ian Campbell
  2013-03-15 13:15 ` [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1) Ian Campbell
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Tim Deegan, Stefano Stabellini, Ian Jackson

The following patches shave some rough edges off the tools build system
to allow cross compiling for at least arm32 and arm64 based on the
Debian/Ubuntu multiarch infrastructure. They also add the necessary
fixes to build for arm64 (which I have only tried cross, not native).

I have posted some instructions on how to compile with these patches on
the wiki:
http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/CrossCompiling

Thanks are due to Wookey who gave lots of good advice in the hackrooms
at LinaroConnect last week.

I consider it an outstanding bug that you need to essentially pass
CROSS_COMPILE and XEN_TARGET_ARCH to both configure and make. This is
hardly the only remaining annoyance in our build system though...

Ian.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1)
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:35   ` Ian Jackson
  2013-03-15 13:15 ` [PATCH 2/9] blktap2: use sys/eventfd.h if it is available Ian Campbell
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

getconf is not cross-compile friendly since it reports the features of the host
and not the target. There doesn't appear to be a $triplet-getconf.

AC_SYS_LARGEFILE arranges for #defines to appear in config.h however Xen's
build system expects these to be part of C{PP}FLAGS. Since I'm not confident
that everything in Xen includes config.h I instead arrange for the result of
running AC_SYS_LARGERFILE to end up in CFLAGS.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 config/Tools.mk.in |    2 +
 tools/Rules.mk     |    5 +-
 tools/config.h.in  |    6 +
 tools/configure    | 1292 +++++++++++++++++++++++++++++++++++++++++-----------
 tools/configure.ac |   10 +
 5 files changed, 1042 insertions(+), 273 deletions(-)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index c69c7d2..5e2c6d8 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -60,3 +60,5 @@ CONFIG_LIBICONV     := @libiconv@
 CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
+
+FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 8d55e03..3f03a31 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -65,11 +65,12 @@ CFLAGS += -D__XEN_TOOLS__
 CFLAGS += -MMD -MF .$(@F).d
 DEPS = .*.d
 
+ifneq ($(FILE_OFFSET_BITS),)
+CFLAGS  += -D_FILE_OFFSET_BITS=$(FILE_OFFSET_BITS)
+endif
 ifneq ($(XEN_OS),NetBSD)
 # Enable implicit LFS support *and* explicit LFS names.
-CFLAGS  += $(shell getconf LFS_CFLAGS)
 CFLAGS  += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-LDFLAGS += $(shell getconf LFS_LDFLAGS)
 endif
 
 # 32-bit x86 does not perform well with -ve segment accesses on Xen.
diff --git a/tools/config.h.in b/tools/config.h.in
index 6d67503..08e337a 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -68,3 +68,9 @@
 
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
diff --git a/tools/configure b/tools/configure
index 068fb75..9f73172 100755
--- a/tools/configure
+++ b/tools/configure
@@ -639,13 +639,6 @@ INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
 SET_MAKE
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
 IASL
 BCC
 LD86
@@ -673,6 +666,14 @@ ocamltools
 xenapi
 monitors
 githttp
+FILE_OFFSET_BITS
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
 host_os
 host_vendor
 host_cpu
@@ -722,6 +723,7 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_largefile
 enable_githttp
 enable_monitors
 enable_xenapi
@@ -737,6 +739,11 @@ enable_debug
       ac_precious_vars='build_alias
 host_alias
 target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
 PREPEND_INCLUDES
 PREPEND_LIB
 APPEND_INCLUDES
@@ -753,11 +760,6 @@ AS86
 LD86
 BCC
 IASL
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
 CPP
 PKG_CONFIG
 PKG_CONFIG_PATH
@@ -1379,6 +1381,7 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-largefile     omit support for large files
   --enable-githttp        Download GIT repositories via HTTP (default is
                           DISABLED)
   --disable-monitors      Disable xenstat and xentop monitoring tools (default
@@ -1394,6 +1397,13 @@ Optional Features:
   --disable-debug         Disable debug build of tools (default is ENABLED)
 
 Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
   PREPEND_INCLUDES
               List of include folders to prepend to CFLAGS (without -I)
   PREPEND_LIB List of library folders to prepend to LDFLAGS (without -L)
@@ -1412,13 +1422,6 @@ Some influential environment variables:
   LD86        Path to ld86 tool
   BCC         Path to bcc tool
   IASL        Path to iasl tool
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
@@ -2266,6 +2269,1004 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+fi
+
+
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+  FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
+;;
+esac
+
+
 # M4 Macro includes
 
 
@@ -3021,256 +4022,6 @@ $as_echo "$ac_try_echo"; } >&5
   test $ac_status = 0; }
 done
 
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { { ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-	;;
-    [ab].out )
-	# We found the default executable, but exeext='' is most
-	# certainly right.
-	break;;
-    *.* )
-	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-	then :; else
-	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	fi
-	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
-	# argument, so we may need to know it at that point already.
-	# Even if this section looks crufty: it has the advantage of
-	# actually working.
-	break;;
-    * )
-	break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-ac_exeext=$ac_cv_exeext
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	  break;;
-    * ) break;;
-  esac
-done
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
-fi
-rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
-  { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-  if { ac_try='./conftest$ac_cv_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
-fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
 if test "${ac_cv_c_compiler_gnu+set}" = set; then :
@@ -5160,8 +5911,7 @@ else
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 fi
-
-ac_ext=c
+ ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
diff --git a/tools/configure.ac b/tools/configure.ac
index 0d38408..f6e2fec 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -21,6 +21,16 @@ APPEND_INCLUDES and APPEND_LIB instead when possible.])
 
 AC_CANONICAL_HOST
 
+AC_SYS_LARGEFILE
+
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+  FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
+;;
+esac
+AC_SUBST(FILE_OFFSET_BITS)
+
 # M4 Macro includes
 m4_include([../m4/savevar.m4])
 m4_include([../m4/features.m4])
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/9] blktap2: use sys/eventfd.h if it is available
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
  2013-03-15 13:15 ` [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1) Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:24   ` Ian Jackson
  2013-03-15 13:15 ` [PATCH 3/9] tools: only build blktap1 on x86 Ian Campbell
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

arm64 only has the eventfd2 system call and using the libc wrapper when
available hides this from us. eventfd() has been in libc since glibc 2.8.

This code is already Linux specific.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/blktap2/drivers/libaio-compat.h |   12 ++++++++++++
 tools/config.h.in                     |    3 +++
 tools/configure                       |    9 +++++----
 tools/configure.ac                    |    2 +-
 4 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/tools/blktap2/drivers/libaio-compat.h b/tools/blktap2/drivers/libaio-compat.h
index 353c36a..47cd96d 100644
--- a/tools/blktap2/drivers/libaio-compat.h
+++ b/tools/blktap2/drivers/libaio-compat.h
@@ -29,6 +29,7 @@
 #ifndef __LIBAIO_COMPAT
 #define __LIBAIO_COMPAT
 
+#include "../../config.h"
 #include <libaio.h>
 #include <unistd.h>
 #include <sys/syscall.h>
@@ -50,6 +51,16 @@ static inline void __io_set_eventfd(struct iocb *iocb, int eventfd)
 	c->resfd = eventfd;
 }
 
+#ifdef HAVE_SYS_EVENTFD_H
+
+#include <sys/eventfd.h>
+
+static inline int tapdisk_sys_eventfd(int initval)
+{
+	return eventfd(initval, 0);
+}
+
+#else /* Fallback */
 #ifndef SYS_eventfd
 #ifndef __NR_eventfd
 # if defined(__alpha__)
@@ -88,5 +99,6 @@ static inline int tapdisk_sys_eventfd(int initval)
 {
 	return syscall(SYS_eventfd, initval, 0);
 }
+#endif
 
 #endif /* __LIBAIO_COMPAT */
diff --git a/tools/config.h.in b/tools/config.h.in
index 08e337a..a67910b 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -27,6 +27,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#undef HAVE_SYS_EVENTFD_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
diff --git a/tools/configure b/tools/configure
index 9f73172..a98dd9e 100755
--- a/tools/configure
+++ b/tools/configure
@@ -7817,12 +7817,13 @@ fi
 
 
 # Checks for header files.
-for ac_header in yajl/yajl_version.h
+for ac_header in yajl/yajl_version.h sys/eventfd.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "yajl/yajl_version.h" "ac_cv_header_yajl_yajl_version_h" "$ac_includes_default"
-if test "x$ac_cv_header_yajl_yajl_version_h" = x""yes; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_YAJL_YAJL_VERSION_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
diff --git a/tools/configure.ac b/tools/configure.ac
index f6e2fec..36a3343 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -166,6 +166,6 @@ AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
 AC_SUBST(libiconv)
 
 # Checks for header files.
-AC_CHECK_HEADERS([yajl/yajl_version.h])
+AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h])
 
 AC_OUTPUT()
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/9] tools: only build blktap1 on x86
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
  2013-03-15 13:15 ` [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1) Ian Campbell
  2013-03-15 13:15 ` [PATCH 2/9] blktap2: use sys/eventfd.h if it is available Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:24   ` Ian Jackson
  2013-03-15 13:15 ` [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling Ian Campbell
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

It does not cross-compile for ARM and no sane new port is going to use it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index bea1489..8a30c83 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -21,7 +21,9 @@ SUBDIRS-y += xenmon
 SUBDIRS-y += xenstat
 SUBDIRS-$(CONFIG_Linux) += $(SUBDIRS-libaio)
 SUBDIRS-$(CONFIG_Linux) += memshr 
+ifeq ($(CONFIG_X86),y)
 SUBDIRS-$(CONFIG_Linux) += blktap
+endif
 SUBDIRS-$(CONFIG_Linux) += blktap2
 SUBDIRS-$(CONFIG_NetBSD) += $(SUBDIRS-libaio)
 SUBDIRS-$(CONFIG_NetBSD) += blktap2
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling.
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (2 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 3/9] tools: only build blktap1 on x86 Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:27   ` Ian Jackson
  2013-03-15 13:15 ` [PATCH 5/9] tools: libxc: arm64 support Ian Campbell
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

tools/python and tools/pygrub are already skipped in tools/Makefile when
cross-compiling, so no point in checking for the prerequisites either.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/configure    |    8 +++++++-
 tools/configure.ac |    6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/configure b/tools/configure
index a98dd9e..4cd46e0 100755
--- a/tools/configure
+++ b/tools/configure
@@ -5911,7 +5911,8 @@ else
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 fi
- ac_ext=c
+
+ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -6308,6 +6309,8 @@ fi
 done
 
 
+if test "$cross_compiling" != yes; then :
+
 
 ac_previous_cppflags=$CPPFLAGS
 ac_previous_ldflags=$LDFLAGS
@@ -6439,6 +6442,9 @@ fi
 CPPFLAGS=$ac_previous_cppflags
 LDLFAGS=$ac_previous_ldflags
 
+
+fi
+
 # Extract the first word of "xgettext", so it can be a program name with args.
 set dummy xgettext; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
diff --git a/tools/configure.ac b/tools/configure.ac
index 36a3343..c5eb2b1 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -121,7 +121,11 @@ AS_IF([echo "$PYTHON" | grep -q "^/"], [
 [AC_MSG_ERROR([PYTHON specified, but is not an absolute path])])
 AX_PATH_PROG_OR_FAIL([PYTHONPATH], [$PYTHON])
 AX_CHECK_PYTHON_VERSION([2], [3])
- AX_CHECK_PYTHON_DEVEL()
+
+AS_IF([test "$cross_compiling" != yes], [
+    AX_CHECK_PYTHON_DEVEL()
+])
+
 AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
 dnl as86, ld86, bcc and iasl are only required when the host system is x86*.
 dnl "host" here means the platform on which the hypervisor and tools is
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/9] tools: libxc: arm64 support
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (3 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:26   ` Ian Jackson
  2013-03-15 13:15 ` [PATCH 6/9] tools: memshr: " Ian Campbell
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/libxc/xc_core.h |    2 +-
 tools/libxc/xenctrl.h |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tools/libxc/xc_core.h b/tools/libxc/xc_core.h
index 67b56a4..10cbfca 100644
--- a/tools/libxc/xc_core.h
+++ b/tools/libxc/xc_core.h
@@ -151,7 +151,7 @@ int xc_core_arch_map_p2m_writable(xc_interface *xch, unsigned int guest_width,
 
 #if defined (__i386__) || defined (__x86_64__)
 # include "xc_core_x86.h"
-#elif defined (__arm__)
+#elif defined (__arm__) || defined(__aarch64__)
 # include "xc_core_arm.h"
 #else
 # error "unsupported architecture"
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 32122fd..50853af 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -79,6 +79,10 @@
 #define xen_mb()   asm volatile ("dmb" : : : "memory")
 #define xen_rmb()  asm volatile ("dmb" : : : "memory")
 #define xen_wmb()  asm volatile ("dmb" : : : "memory")
+#elif defined(__aarch64__)
+#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
+#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
+#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")
 #else
 #error "Define barriers"
 #endif
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 6/9] tools: memshr: arm64 support
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (4 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 5/9] tools: libxc: arm64 support Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:29   ` Ian Jackson
  2013-03-19 15:52   ` Stefano Stabellini
  2013-03-15 13:15 ` [PATCH 7/9] xenctx: Support arm64 Ian Campbell
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

I'm not mad keen on propagating these sorts of asm atomic operations throughout
our code base. Other options would be:

- use libatomic-ops, http://www.hpl.hp.com/research/linux/atomic_ops/, although
  this doesn't seem to be as widespread as I would like (not in RHEL5 for
  example)
- use a pthread lock. This is probably the simplest/best option but I wasn't
  able to figure out the locking hierarchy of this code

So I've coped out and just copied the appropriate inlines here.

I also nuked some stray ia64 support and fixed a coment in the arm32 version
while I was here.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/memshr/bidir-hash.c |   48 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/tools/memshr/bidir-hash.c b/tools/memshr/bidir-hash.c
index 45d473e..bed8179 100644
--- a/tools/memshr/bidir-hash.c
+++ b/tools/memshr/bidir-hash.c
@@ -100,22 +100,13 @@ int            __hash_iterator(struct __hash *h,
                         void *d);
 static void      hash_resize(struct __hash *h);
 
-#if defined(__ia64__)
-#define ia64_fetchadd4_rel(p, inc) do {                         \
-    uint64_t ia64_intri_res;                                    \
-    asm volatile ("fetchadd4.rel %0=[%1],%2"                    \
-                : "=r"(ia64_intri_res) : "r"(p), "i" (inc)      \
-                : "memory");                                    \
-} while (0)
-static inline void atomic_inc(uint32_t *v) { ia64_fetchadd4_rel(v, 1); }
-static inline void atomic_dec(uint32_t *v) { ia64_fetchadd4_rel(v, -1); }
-#elif defined(__arm__)
+#if defined(__arm__)
 static inline void atomic_inc(uint32_t *v)
 {
         unsigned long tmp;
         int result;
 
-        __asm__ __volatile__("@ atomic_add\n"
+        __asm__ __volatile__("@ atomic_inc\n"
 "1:     ldrex   %0, [%3]\n"
 "       add     %0, %0, #1\n"
 "       strex   %1, %0, [%3]\n"
@@ -130,7 +121,7 @@ static inline void atomic_dec(uint32_t *v)
         unsigned long tmp;
         int result;
 
-        __asm__ __volatile__("@ atomic_sub\n"
+        __asm__ __volatile__("@ atomic_dec\n"
 "1:     ldrex   %0, [%3]\n"
 "       sub     %0, %0, #1\n"
 "       strex   %1, %0, [%3]\n"
@@ -140,6 +131,39 @@ static inline void atomic_dec(uint32_t *v)
         : "r" (v)
         : "cc");
 }
+
+#elif defined(__aarch64__)
+
+static inline void atomic_inc(uint32_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        asm volatile("// atomic_inc\n"
+"1:     ldxr    %w0, [%3]\n"
+"       add     %w0, %w0, #1\n"
+"       stxr    %w1, %w0, [%3]\n"
+"       cbnz    %w1, 1b"
+        : "=&r" (result), "=&r" (tmp), "+o" (v)
+        : "r" (v)
+        : "cc");
+}
+
+static inline void atomic_dec(uint32_t *v)
+{
+        unsigned long tmp;
+        int result;
+
+        asm volatile("// atomic_dec\n"
+"1:     ldxr    %w0, [%3]\n"
+"       sub     %w0, %w0, #1\n"
+"       stxr    %w1, %w0, [%3]\n"
+"       cbnz    %w1, 1b"
+        : "=&r" (result), "=&r" (tmp), "+o" (v)
+        : "r" (v)
+        : "cc");
+}
+
 #else /* __x86__ */
 static inline void atomic_inc(uint32_t *v)
 {
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 7/9] xenctx: Support arm64.
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (5 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 6/9] tools: memshr: " Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-15 15:30   ` Ian Jackson
  2013-03-15 13:15 ` [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32 Ian Campbell
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

I also nuked some stray ia64 support while I was here.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/xentrace/xenctx.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 62327f7..d47b7da 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -49,23 +49,16 @@ int guest_word_size = sizeof (unsigned long);
 /* Word-length of the context record we get from xen */
 int ctxt_word_size = sizeof (unsigned long);
 int guest_protected_mode = 1;
-#elif defined (__ia64__)
-/* On ia64, we can't translate virtual address to physical address.  */
-#define NO_TRANSLATION
-typedef size_t guest_word_t;
-
-/* Which registers should be displayed.  */
-int disp_cr_regs;
-int disp_ar_regs;
-int disp_br_regs;
-int disp_bank_regs;
-int disp_tlb;
-
 #elif defined(__arm__)
 #define NO_TRANSLATION
 typedef uint64_t guest_word_t;
 #define FMT_32B_WORD "%08llx"
 #define FMT_64B_WORD "%016llx"
+#elif defined(__aarch64__)
+#define NO_TRANSLATION
+typedef uint64_t guest_word_t;
+#define FMT_32B_WORD "%08lx"
+#define FMT_64B_WORD "%016lx"
 #endif
 
 struct symbol {
@@ -684,7 +677,7 @@ void print_ctx(vcpu_guest_context_any_t *ctx)
             print_tr(i, &tr->dtrs[i]);
     }
 }
-#elif defined(__arm__)
+#elif defined(__arm__) || defined(__aarch64__)
 static void print_ctx(vcpu_guest_context_any_t *ctx)
 {
     /* XXX: properly implement this */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (6 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 7/9] xenctx: Support arm64 Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-19 15:48   ` Stefano Stabellini
  2013-03-15 13:15 ` [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface Ian Campbell
  2013-04-11 10:09 ` [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/include/public/io/protocols.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xen/include/public/io/protocols.h b/xen/include/public/io/protocols.h
index d932edc..80b196b 100644
--- a/xen/include/public/io/protocols.h
+++ b/xen/include/public/io/protocols.h
@@ -31,7 +31,7 @@
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
 #elif defined(__x86_64__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
-#elif defined(__arm__)
+#elif defined(__arm__) || defined(__aarch64__)
 # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
 #else
 # error arch fixup needed here
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface.
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (7 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32 Ian Campbell
@ 2013-03-15 13:15 ` Ian Campbell
  2013-03-19 15:49   ` Stefano Stabellini
  2013-04-11 10:09 ` [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
  9 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 13:15 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, Ian Campbell, ian.jackson

This is also defined in sys/ptrace.h on arm64 which breaks the tools build due
to multiple definitions. I expect this is really a bug in the kernel and/or
glibc but we don't really need this symbol in the public headers, at least not
right now, so move it into include/asm instead.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/arch/arm/arm32/entry.S    |    1 +
 xen/arch/arm/arm64/entry.S    |    1 +
 xen/include/asm-arm/regs.h    |    6 ++++++
 xen/include/public/arch-arm.h |    3 ---
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 3611427..76814dd 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -1,5 +1,6 @@
 #include <xen/config.h>
 #include <asm/asm_defns.h>
+#include <asm/regs.h>
 #include <public/xen.h>
 
 #define SAVE_ONE_BANKED(reg)    mrs r11, reg; str r11, [sp, #UREGS_##reg]
diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 9d38088..5656f45 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -1,5 +1,6 @@
 #include <xen/config.h>
 #include <asm/asm_defns.h>
+#include <asm/regs.h>
 #include <public/xen.h>
 
 /*
diff --git a/xen/include/asm-arm/regs.h b/xen/include/asm-arm/regs.h
index 079c0ca..0130b94 100644
--- a/xen/include/asm-arm/regs.h
+++ b/xen/include/asm-arm/regs.h
@@ -1,6 +1,10 @@
 #ifndef __ARM_REGS_H__
 #define __ARM_REGS_H__
 
+#define PSR_MODE_MASK 0x1f
+
+#ifndef __ASSEMBLY__
+
 #include <xen/types.h>
 #include <public/xen.h>
 #include <asm/processor.h>
@@ -42,6 +46,8 @@
  */
 extern register_t *select_user_reg(struct cpu_user_regs *regs, int reg);
 
+#endif
+
 #endif /* __ARM_REGS_H__ */
 /*
  * Local variables:
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 3333399..2addf60 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -195,9 +195,6 @@ typedef uint64_t xen_callback_t;
 
 /* PSR bits (CPSR, SPSR)*/
 
-/* 0-4: Mode */
-#define PSR_MODE_MASK 0x1f
-
 /* 32 bit modes */
 #define PSR_MODE_USR 0x10
 #define PSR_MODE_FIQ 0x11
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/9] blktap2: use sys/eventfd.h if it is available
  2013-03-15 13:15 ` [PATCH 2/9] blktap2: use sys/eventfd.h if it is available Ian Campbell
@ 2013-03-15 15:24   ` Ian Jackson
  0 siblings, 0 replies; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:24 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 2/9] blktap2: use sys/eventfd.h if it is available"):
> arm64 only has the eventfd2 system call and using the libc wrapper when
> available hides this from us. eventfd() has been in libc since glibc 2.8.
> 
> This code is already Linux specific.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/9] tools: only build blktap1 on x86
  2013-03-15 13:15 ` [PATCH 3/9] tools: only build blktap1 on x86 Ian Campbell
@ 2013-03-15 15:24   ` Ian Jackson
  0 siblings, 0 replies; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:24 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 3/9] tools: only build blktap1 on x86"):
> It does not cross-compile for ARM and no sane new port is going to use it.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/9] tools: libxc: arm64 support
  2013-03-15 13:15 ` [PATCH 5/9] tools: libxc: arm64 support Ian Campbell
@ 2013-03-15 15:26   ` Ian Jackson
  2013-03-15 16:31     ` Tim Deegan
  0 siblings, 1 reply; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:26 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 5/9] tools: libxc: arm64 support"):
> +#elif defined(__aarch64__)
> +#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
> +#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
> +#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")

Someone who has read the arm64 manual should ack this.

Ian.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling.
  2013-03-15 13:15 ` [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling Ian Campbell
@ 2013-03-15 15:27   ` Ian Jackson
  0 siblings, 0 replies; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:27 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 4/9] tools: only check for Python devel tools if not cross-compiling."):
> tools/python and tools/pygrub are already skipped in tools/Makefile when
> cross-compiling, so no point in checking for the prerequisites either.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 6/9] tools: memshr: arm64 support
  2013-03-15 13:15 ` [PATCH 6/9] tools: memshr: " Ian Campbell
@ 2013-03-15 15:29   ` Ian Jackson
  2013-03-19 15:52   ` Stefano Stabellini
  1 sibling, 0 replies; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:29 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 6/9] tools: memshr: arm64 support"):
> I'm not mad keen on propagating these sorts of asm atomic operations
> throughout our code base. Other options would be:

How unpleasant, indeed.

> So I've coped out and just copied the appropriate inlines here.

Understandable.  (YM "copped".)

This looks plausible to me so
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
but it needs review by someone who has read the arm64 manual.

Ian.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 7/9] xenctx: Support arm64.
  2013-03-15 13:15 ` [PATCH 7/9] xenctx: Support arm64 Ian Campbell
@ 2013-03-15 15:30   ` Ian Jackson
  2013-03-15 15:43     ` Ian Campbell
  0 siblings, 1 reply; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:30 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 7/9] xenctx: Support arm64."):
> I also nuked some stray ia64 support while I was here.

Doesn't arm64 have some more registers ?

Ian.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1)
  2013-03-15 13:15 ` [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1) Ian Campbell
@ 2013-03-15 15:35   ` Ian Jackson
  0 siblings, 0 replies; 23+ messages in thread
From: Ian Jackson @ 2013-03-15 15:35 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

Ian Campbell writes ("[PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1)"):
> getconf is not cross-compile friendly since it reports the features of the host
> and not the target. There doesn't appear to be a $triplet-getconf.
> 
> AC_SYS_LARGEFILE arranges for #defines to appear in config.h however Xen's
> build system expects these to be part of C{PP}FLAGS. Since I'm not confident
> that everything in Xen includes config.h I instead arrange for the result of
> running AC_SYS_LARGERFILE to end up in CFLAGS.

This looks plausible, assuming you've actually tested it :-).

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 7/9] xenctx: Support arm64.
  2013-03-15 15:30   ` Ian Jackson
@ 2013-03-15 15:43     ` Ian Campbell
  0 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2013-03-15 15:43 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Stefano Stabellini, Tim (Xen.org), xen-devel

On Fri, 2013-03-15 at 15:30 +0000, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH 7/9] xenctx: Support arm64."):
> > I also nuked some stray ia64 support while I was here.
> 
> Doesn't arm64 have some more registers ?

Yes, which would matter except:
        
        #elif defined(__arm__)
        static void print_ctx(vcpu_guest_context_any_t *ctx)
        {
            /* XXX: properly implement this */
            print_symbol(0);
        }
        #endif

Ahem.... I expect it wouldn't run on arm64 due to this missing symbol.

I also missed a whole load of other ia64 remnants in here.

Ian.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/9] tools: libxc: arm64 support
  2013-03-15 15:26   ` Ian Jackson
@ 2013-03-15 16:31     ` Tim Deegan
  0 siblings, 0 replies; 23+ messages in thread
From: Tim Deegan @ 2013-03-15 16:31 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Ian Campbell, Stefano Stabellini

At 15:26 +0000 on 15 Mar (1363361178), Ian Jackson wrote:
> Ian Campbell writes ("[PATCH 5/9] tools: libxc: arm64 support"):
> > +#elif defined(__aarch64__)
> > +#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
> > +#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
> > +#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")
> 
> Someone who has read the arm64 manual should ack this.

Acked-by: Tim Deegan <tim@xen.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32
  2013-03-15 13:15 ` [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32 Ian Campbell
@ 2013-03-19 15:48   ` Stefano Stabellini
  0 siblings, 0 replies; 23+ messages in thread
From: Stefano Stabellini @ 2013-03-19 15:48 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ian Jackson, Stefano Stabellini, Tim (Xen.org), xen-devel

On Fri, 15 Mar 2013, Ian Campbell wrote:
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  xen/include/public/io/protocols.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xen/include/public/io/protocols.h b/xen/include/public/io/protocols.h
> index d932edc..80b196b 100644
> --- a/xen/include/public/io/protocols.h
> +++ b/xen/include/public/io/protocols.h
> @@ -31,7 +31,7 @@
>  # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
>  #elif defined(__x86_64__)
>  # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
> -#elif defined(__arm__)
> +#elif defined(__arm__) || defined(__aarch64__)
>  # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
>  #else
>  # error arch fixup needed here
> -- 
> 1.7.2.5
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface.
  2013-03-15 13:15 ` [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface Ian Campbell
@ 2013-03-19 15:49   ` Stefano Stabellini
  0 siblings, 0 replies; 23+ messages in thread
From: Stefano Stabellini @ 2013-03-19 15:49 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ian Jackson, Stefano Stabellini, Tim (Xen.org), xen-devel

On Fri, 15 Mar 2013, Ian Campbell wrote:
> This is also defined in sys/ptrace.h on arm64 which breaks the tools build due
> to multiple definitions. I expect this is really a bug in the kernel and/or
> glibc but we don't really need this symbol in the public headers, at least not
> right now, so move it into include/asm instead.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  xen/arch/arm/arm32/entry.S    |    1 +
>  xen/arch/arm/arm64/entry.S    |    1 +
>  xen/include/asm-arm/regs.h    |    6 ++++++
>  xen/include/public/arch-arm.h |    3 ---
>  4 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
> index 3611427..76814dd 100644
> --- a/xen/arch/arm/arm32/entry.S
> +++ b/xen/arch/arm/arm32/entry.S
> @@ -1,5 +1,6 @@
>  #include <xen/config.h>
>  #include <asm/asm_defns.h>
> +#include <asm/regs.h>
>  #include <public/xen.h>
>  
>  #define SAVE_ONE_BANKED(reg)    mrs r11, reg; str r11, [sp, #UREGS_##reg]
> diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
> index 9d38088..5656f45 100644
> --- a/xen/arch/arm/arm64/entry.S
> +++ b/xen/arch/arm/arm64/entry.S
> @@ -1,5 +1,6 @@
>  #include <xen/config.h>
>  #include <asm/asm_defns.h>
> +#include <asm/regs.h>
>  #include <public/xen.h>
>  
>  /*
> diff --git a/xen/include/asm-arm/regs.h b/xen/include/asm-arm/regs.h
> index 079c0ca..0130b94 100644
> --- a/xen/include/asm-arm/regs.h
> +++ b/xen/include/asm-arm/regs.h
> @@ -1,6 +1,10 @@
>  #ifndef __ARM_REGS_H__
>  #define __ARM_REGS_H__
>  
> +#define PSR_MODE_MASK 0x1f
> +
> +#ifndef __ASSEMBLY__
> +
>  #include <xen/types.h>
>  #include <public/xen.h>
>  #include <asm/processor.h>
> @@ -42,6 +46,8 @@
>   */
>  extern register_t *select_user_reg(struct cpu_user_regs *regs, int reg);
>  
> +#endif
> +
>  #endif /* __ARM_REGS_H__ */
>  /*
>   * Local variables:
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index 3333399..2addf60 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -195,9 +195,6 @@ typedef uint64_t xen_callback_t;
>  
>  /* PSR bits (CPSR, SPSR)*/
>  
> -/* 0-4: Mode */
> -#define PSR_MODE_MASK 0x1f
> -
>  /* 32 bit modes */
>  #define PSR_MODE_USR 0x10
>  #define PSR_MODE_FIQ 0x11
> -- 
> 1.7.2.5
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 6/9] tools: memshr: arm64 support
  2013-03-15 13:15 ` [PATCH 6/9] tools: memshr: " Ian Campbell
  2013-03-15 15:29   ` Ian Jackson
@ 2013-03-19 15:52   ` Stefano Stabellini
  1 sibling, 0 replies; 23+ messages in thread
From: Stefano Stabellini @ 2013-03-19 15:52 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ian Jackson, Stefano Stabellini, Tim (Xen.org), xen-devel

On Fri, 15 Mar 2013, Ian Campbell wrote:
> I'm not mad keen on propagating these sorts of asm atomic operations throughout
> our code base. Other options would be:
> 
> - use libatomic-ops, http://www.hpl.hp.com/research/linux/atomic_ops/, although
>   this doesn't seem to be as widespread as I would like (not in RHEL5 for
>   example)
> - use a pthread lock. This is probably the simplest/best option but I wasn't
>   able to figure out the locking hierarchy of this code
> 
> So I've coped out and just copied the appropriate inlines here.
> 
> I also nuked some stray ia64 support and fixed a coment in the arm32 version
> while I was here.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


>  tools/memshr/bidir-hash.c |   48 +++++++++++++++++++++++++++++++++-----------
>  1 files changed, 36 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/memshr/bidir-hash.c b/tools/memshr/bidir-hash.c
> index 45d473e..bed8179 100644
> --- a/tools/memshr/bidir-hash.c
> +++ b/tools/memshr/bidir-hash.c
> @@ -100,22 +100,13 @@ int            __hash_iterator(struct __hash *h,
>                          void *d);
>  static void      hash_resize(struct __hash *h);
>  
> -#if defined(__ia64__)
> -#define ia64_fetchadd4_rel(p, inc) do {                         \
> -    uint64_t ia64_intri_res;                                    \
> -    asm volatile ("fetchadd4.rel %0=[%1],%2"                    \
> -                : "=r"(ia64_intri_res) : "r"(p), "i" (inc)      \
> -                : "memory");                                    \
> -} while (0)
> -static inline void atomic_inc(uint32_t *v) { ia64_fetchadd4_rel(v, 1); }
> -static inline void atomic_dec(uint32_t *v) { ia64_fetchadd4_rel(v, -1); }
> -#elif defined(__arm__)
> +#if defined(__arm__)
>  static inline void atomic_inc(uint32_t *v)
>  {
>          unsigned long tmp;
>          int result;
>  
> -        __asm__ __volatile__("@ atomic_add\n"
> +        __asm__ __volatile__("@ atomic_inc\n"
>  "1:     ldrex   %0, [%3]\n"
>  "       add     %0, %0, #1\n"
>  "       strex   %1, %0, [%3]\n"
> @@ -130,7 +121,7 @@ static inline void atomic_dec(uint32_t *v)
>          unsigned long tmp;
>          int result;
>  
> -        __asm__ __volatile__("@ atomic_sub\n"
> +        __asm__ __volatile__("@ atomic_dec\n"
>  "1:     ldrex   %0, [%3]\n"
>  "       sub     %0, %0, #1\n"
>  "       strex   %1, %0, [%3]\n"
> @@ -140,6 +131,39 @@ static inline void atomic_dec(uint32_t *v)
>          : "r" (v)
>          : "cc");
>  }
> +
> +#elif defined(__aarch64__)
> +
> +static inline void atomic_inc(uint32_t *v)
> +{
> +        unsigned long tmp;
> +        int result;
> +
> +        asm volatile("// atomic_inc\n"
> +"1:     ldxr    %w0, [%3]\n"
> +"       add     %w0, %w0, #1\n"
> +"       stxr    %w1, %w0, [%3]\n"
> +"       cbnz    %w1, 1b"
> +        : "=&r" (result), "=&r" (tmp), "+o" (v)
> +        : "r" (v)
> +        : "cc");
> +}
> +
> +static inline void atomic_dec(uint32_t *v)
> +{
> +        unsigned long tmp;
> +        int result;
> +
> +        asm volatile("// atomic_dec\n"
> +"1:     ldxr    %w0, [%3]\n"
> +"       sub     %w0, %w0, #1\n"
> +"       stxr    %w1, %w0, [%3]\n"
> +"       cbnz    %w1, 1b"
> +        : "=&r" (result), "=&r" (tmp), "+o" (v)
> +        : "r" (v)
> +        : "cc");
> +}
> +
>  #else /* __x86__ */
>  static inline void atomic_inc(uint32_t *v)
>  {
> -- 
> 1.7.2.5
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64
  2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
                   ` (8 preceding siblings ...)
  2013-03-15 13:15 ` [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface Ian Campbell
@ 2013-04-11 10:09 ` Ian Campbell
  9 siblings, 0 replies; 23+ messages in thread
From: Ian Campbell @ 2013-04-11 10:09 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Tim (Xen.org), Stefano Stabellini

On Fri, 2013-03-15 at 13:15 +0000, Ian Campbell wrote:
> The following patches shave some rough edges off the tools build system
> to allow cross compiling for at least arm32 and arm64 based on the
> Debian/Ubuntu multiarch infrastructure. They also add the necessary
> fixes to build for arm64 (which I have only tried cross, not native).
> 
> I have posted some instructions on how to compile with these patches on
> the wiki:
> http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/CrossCompiling

I applied all of this except #7 (xenctx one) which I need to have
another look at.

Ian.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2013-04-11 10:09 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
2013-03-15 13:15 ` [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1) Ian Campbell
2013-03-15 15:35   ` Ian Jackson
2013-03-15 13:15 ` [PATCH 2/9] blktap2: use sys/eventfd.h if it is available Ian Campbell
2013-03-15 15:24   ` Ian Jackson
2013-03-15 13:15 ` [PATCH 3/9] tools: only build blktap1 on x86 Ian Campbell
2013-03-15 15:24   ` Ian Jackson
2013-03-15 13:15 ` [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling Ian Campbell
2013-03-15 15:27   ` Ian Jackson
2013-03-15 13:15 ` [PATCH 5/9] tools: libxc: arm64 support Ian Campbell
2013-03-15 15:26   ` Ian Jackson
2013-03-15 16:31     ` Tim Deegan
2013-03-15 13:15 ` [PATCH 6/9] tools: memshr: " Ian Campbell
2013-03-15 15:29   ` Ian Jackson
2013-03-19 15:52   ` Stefano Stabellini
2013-03-15 13:15 ` [PATCH 7/9] xenctx: Support arm64 Ian Campbell
2013-03-15 15:30   ` Ian Jackson
2013-03-15 15:43     ` Ian Campbell
2013-03-15 13:15 ` [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32 Ian Campbell
2013-03-19 15:48   ` Stefano Stabellini
2013-03-15 13:15 ` [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface Ian Campbell
2013-03-19 15:49   ` Stefano Stabellini
2013-04-11 10:09 ` [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.