diff mbox

PowerPC: define _CALL_ELF if compiler does not define it

Message ID 532C87B9.6020905@linux.vnet.ibm.com
State New
Headers show

Commit Message

Adhemerval Zanella March 21, 2014, 6:40 p.m. UTC
This patch make the configure adds -D_CALL_ELF=1 when compiler does
not define _CALL_ELF (versions before powerpc64le support).

This clean up the compiler warnings on old compiler where _CALL_ELF is
not defined on powerpc64(be) builds.

--

	* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
	(libc_cv_ppc64_def_call_elf): Define it to yes if compiler does not set
	_CALL_ELF.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure: Regenerate.

---

Comments

Roland McGrath March 21, 2014, 8:10 p.m. UTC | #1
It seems questionable to modify CFLAGS for this.  It probably belongs in
CPPFLAGS, to begin with.  But I'm not sure I like it modifying the user's
CPPFLAGS either.  It might be best to add a new config.make variable for
configure-deduced (as opposed to user-specified) CPPFLAGS and accumulate
into that.  It would be an analogue to config-extra-cflags
(libc_extra_cflags in configure).  While you're at it, generalize
libc_extra_cflags so it accumulates and could be used by sysdeps configure
fragments, rather than just being single-purpose as it is today.
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
index fbb6334..d7bd482 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
@@ -163,4 +163,31 @@  default-abi = 64-v2"
 else
   config_vars="$config_vars
 default-abi = 64-v1"
+  # Compiler which do not support ELFv2 ABI does not define _CALL_ELF
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler defines _CALL_ELF" >&5
+$as_echo_n "checking whether the compiler defines _CALL_ELF... " >&6; }
+if ${libc_cv_ppc64_def_call_elf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef _CALL_ELF
+                        yes
+                       #endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  libc_cv_ppc64_def_call_elf=yes
+else
+  libc_cv_ppc64_def_call_elf=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ppc64_def_call_elf" >&5
+$as_echo "$libc_cv_ppc64_def_call_elf" >&6; }
+  if test $libc_cv_ppc64_def_call_elf = no; then
+    CFLAGS="$CFLAGS -D_CALL_ELF=1"
+  fi
 fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
index c9cd4bc..d3c1441 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
@@ -12,4 +12,14 @@  if test $libc_cv_ppc64_elfv2_abi = yes; then
   LIBC_CONFIG_VAR([default-abi], [64-v2])
 else
   LIBC_CONFIG_VAR([default-abi], [64-v1])
+  # Compiler which do not support ELFv2 ABI does not define _CALL_ELF
+  AC_CACHE_CHECK([whether the compiler defines _CALL_ELF],
+    [libc_cv_ppc64_def_call_elf],
+    [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF
+                        yes
+                       #endif
+    ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)])
+  if test $libc_cv_ppc64_def_call_elf = no; then
+    CFLAGS="$CFLAGS -D_CALL_ELF=1"
+  fi
 fi