[2.24] powerpc: Prevent building POWER8 code without support in assembler

Message ID 1469046034-28470-1-git-send-email-tuliom@linux.vnet.ibm.com
State Dropped
Headers

Commit Message

Tulio Magno Quites Machado Filho July 20, 2016, 8:20 p.m. UTC
  Confirm if the assembler supports the submachine specified at --with-cpu
or required by --enable-multi-arch preventing errors at build time.
The minimum Binutils version supported (v2.22) doesn't support POWER8
which is used on --enable-multi-arch.

2016-07-20  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	* sysdeps/powerpc/configure: Auto-generate.
	* sysdeps/powerpc/configure.ac: Check if the assembler supports
	the submachine.
---
 sysdeps/powerpc/configure    | 52 ++++++++++++++++++++++++++++++++++++++++++++
 sysdeps/powerpc/configure.ac | 43 ++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 sysdeps/powerpc/configure
 create mode 100644 sysdeps/powerpc/configure.ac
  

Patch

diff --git a/sysdeps/powerpc/configure b/sysdeps/powerpc/configure
new file mode 100644
index 0000000..dbc20e9
--- /dev/null
+++ b/sysdeps/powerpc/configure
@@ -0,0 +1,52 @@ 
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/powerpc.
+
+# The minimum Binutils version required by glibc may not support all the
+# processors supported by glibc, e.g. Binutils 2.22 supports POWER7 at most.
+libc_cv_ppc_cpu_min=
+libc_cv_ppc_cpu_msg=
+
+if test x"$multi_arch" != xno ; then
+    libc_cv_ppc_cpu_min=power8
+  libc_cv_ppc_cpu_msg=", required by --enable-multi-arch"
+fi
+
+if test -n "$submachine"; then
+  case "$submachine" in
+  # List of the submachines not supported by the minimum required Binutils.
+  power8|power9)
+    libc_cv_ppc_cpu_min=$submachine
+    libc_cv_ppc_cpu_msg=
+    ;;
+  esac
+fi
+
+if test -n "$libc_cv_ppc_cpu_min"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $libc_cv_ppc_cpu_min support in assembler" >&5
+$as_echo_n "checking for $libc_cv_ppc_cpu_min support in assembler... " >&6; }
+if ${libc_cv_ppc_machine+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.s <<EOF
+	.machine "$libc_cv_ppc_cpu_min"
+	blr
+EOF
+if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+  libc_cv_ppc_machine=yes
+else
+  libc_cv_ppc_machine=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ppc_machine" >&5
+$as_echo "$libc_cv_ppc_machine" >&6; }
+  if test $libc_cv_ppc_machine != yes; then
+    as_fn_error $? "The assembler does not support $libc_cv_ppc_cpu_min\
+$libc_cv_ppc_cpu_msg." "$LINENO" 5
+  fi
+fi
diff --git a/sysdeps/powerpc/configure.ac b/sysdeps/powerpc/configure.ac
new file mode 100644
index 0000000..ba9fa25
--- /dev/null
+++ b/sysdeps/powerpc/configure.ac
@@ -0,0 +1,43 @@ 
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/powerpc.
+
+# The minimum Binutils version required by glibc may not support all the
+# processors supported by glibc, e.g. Binutils 2.22 supports POWER7 at most.
+libc_cv_ppc_cpu_min=
+libc_cv_ppc_cpu_msg=
+
+if test x"$multi_arch" != xno ; then
+  dnl Multiarch build requires POWER8 support.
+  libc_cv_ppc_cpu_min=power8
+  libc_cv_ppc_cpu_msg=", required by --enable-multi-arch"
+fi
+
+if test -n "$submachine"; then
+  case "$submachine" in
+  # List of the submachines not supported by the minimum required Binutils.
+  power8|power9)
+    libc_cv_ppc_cpu_min=$submachine
+    libc_cv_ppc_cpu_msg=
+    ;;
+  esac
+fi
+
+if test -n "$libc_cv_ppc_cpu_min"; then
+  dnl Check if asm supports the minimum cpu.
+  AC_CACHE_CHECK([for $libc_cv_ppc_cpu_min support in assembler],
+		 libc_cv_ppc_machine, [dnl
+cat > conftest.s <<EOF
+	.machine "$libc_cv_ppc_cpu_min"
+	blr
+EOF
+if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
+  libc_cv_ppc_machine=yes
+else
+  libc_cv_ppc_machine=no
+fi
+rm -f conftest*])
+  if test $libc_cv_ppc_machine != yes; then
+    AC_MSG_ERROR([The assembler does not support $libc_cv_ppc_cpu_min\
+$libc_cv_ppc_cpu_msg.])
+  fi
+fi