PowerPC: define _CALL_ELF if compiler does not
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Sun, 6 Apr 2014 21:26:32 +0000 (16:26 -0500)
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Sun, 6 Apr 2014 21:48:08 +0000 (16:48 -0500)
This patch makes the configure adds -D_CALL_ELF=1 when compiler does
not define _CALL_ELF (versions before powerpc64le support).  It cleans
up compiler warnings on old compiler where _CALL_ELF is not defined
on powerpc64(be) builds.

It does by add a new config.make variable for configure-deduced
CPPFLAGS and accumulate into that (confix-extra-cppflags).  It also
generalizes libc_extra_cflags so it accumulates in sysdeps configure
fragmenets.

ChangeLog
Makeconfig
config.make.in
configure
configure.ac
sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac

index faaea3c..221a474 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2014-04-06  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
+       * Makeconfig (CPPFLAGS): Add config-extra-cppflags to list.
+       * config.make.in (config-extra-cppflags): Set it from
+       libc_extra_cppflags.
+       * configure.ac (libc_extra_cflags): Make it accumulate over
+       configure fragments.
+       (libc_extra_cppflags): New flag.
+       * configure. Regenerate.
+       * 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 and add -D_CALL_ELF=1 to libc_extra_cppflags.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/configure: Regenerate.
+
+2014-04-06  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
        [BZ #16815]
        * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Fix
        result for FE_DOWNWARD rounding mode.
index 3338ab6..f965398 100644 (file)
@@ -792,7 +792,8 @@ libio-include = -I$(..)libio
 # Note that we can't use -std=* in CPPFLAGS, because it overrides
 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
 # it causes cpp to stop predefining __ASSEMBLER__.
-CPPFLAGS = $(CPPUNDEFS) $(CPPFLAGS-config) $($(subdir)-CPPFLAGS) \
+CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
+          $($(subdir)-CPPFLAGS) \
           $(+includes) $(defines) \
           -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
           $(CPPFLAGS-$(suffix $@)) \
index 416fb9e..132d179 100644 (file)
@@ -37,6 +37,7 @@ cflags-cpu = @libc_cv_cc_submachine@
 asflags-cpu = @libc_cv_cc_submachine@
 
 config-extra-cflags = @libc_extra_cflags@
+config-extra-cppflags = @libc_extra_cppflags@
 config-cflags-nofma = @libc_cv_cc_nofma@
 
 defines = @DEFINES@
index d4b5edb..abefcdb 100755 (executable)
--- a/configure
+++ b/configure
@@ -591,6 +591,7 @@ libc_cv_slibdir
 old_glibc_headers
 use_nscd
 libc_cv_gcc_unwind_find_fde
+libc_extra_cppflags
 libc_extra_cflags
 CPPUNDEFS
 sizeof_long_double
@@ -7199,9 +7200,9 @@ fi
 $as_echo "$libc_cv_predef_stack_protector" >&6; }
 libc_extra_cflags=
 if test $libc_cv_predef_stack_protector = yes; then
-  libc_extra_cflags=-fno-stack-protector
+  libc_extra_cflags="$libc_extra_cflags -fno-stack-protector"
 fi
-
+libc_extra_cppflags=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker provides __ehdr_start" >&5
 $as_echo_n "checking whether the linker provides __ehdr_start... " >&6; }
@@ -7266,6 +7267,9 @@ $as_echo "running configure fragment for $dir" >&6; }
   fi
 done
 
+
+
+
 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
   $as_echo "#define EXPORT_UNWIND_FIND_FDE 1" >>confdefs.h
 
index 43bd8a5..6291872 100644 (file)
@@ -2042,9 +2042,9 @@ esac],
 ])
 libc_extra_cflags=
 if test $libc_cv_predef_stack_protector = yes; then
-  libc_extra_cflags=-fno-stack-protector
+  libc_extra_cflags="$libc_extra_cflags -fno-stack-protector"
 fi
-AC_SUBST(libc_extra_cflags)
+libc_extra_cppflags=
 
 AC_CACHE_CHECK([whether the linker provides __ehdr_start],
               libc_cv_ehdr_start, [
@@ -2091,6 +2091,9 @@ for dir in $sysnames; do
   fi
 done
 
+AC_SUBST(libc_extra_cflags)
+AC_SUBST(libc_extra_cppflags)
+
 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
 fi
index fbb6334..8262fdd 100644 (file)
@@ -163,4 +163,31 @@ default-abi = 64-v2"
 else
   config_vars="$config_vars
 default-abi = 64-v1"
+  # Compiler that 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
+    libc_extra_cppflags="$libc_extra_cppflags -D_CALL_ELF=1"
+  fi
 fi
index c9cd4bc..d60b05e 100644 (file)
@@ -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 that 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
+    libc_extra_cppflags="$libc_extra_cppflags -D_CALL_ELF=1"
+  fi
 fi