In the past I was asked to post bugzilla patches here. I am doing this.
It fixes a build failure.

PR target/85904
libstdc++-v3/crossconfig.m4: test for aligned_alloc on netbsd
libstdc++-v3/configure: Regenerate

Attached is patch.
>From ac7a1f364b0ca5e3a6a5a68a16266d1cb78ee5da Mon Sep 17 00:00:00 2001
From: Maya Rashish <co...@sdf.org>
Date: Thu, 24 May 2018 16:05:27 +0300
Subject: [PATCH 1/1] check for aligned_alloc on netbsd crosscompilation.

Fixes build issue:
/home/fly/gcc/libstdc++-v3/libsupc++/new_opa.cc:62:1: error: 'void* 
aligned_alloc(std::size_t, std::size_t)' was declared 'extern' and later 
'static' [-fpermissive]
 aligned_alloc (std::size_t al, std::size_t sz)
 ^~~~~~~~~~~~~
In file included from /tmp/build/alpha--netbsd/libstdc++-v3/include/cstdlib:75,
                 from /tmp/build/alpha--netbsd/libstdc++-v3/include/stdlib.h:36,
                 from /home/fly/gcc/libstdc++-v3/libsupc++/new_opa.cc:27:
/tmp/build/gcc/include-fixed/stdlib.h:254:7: note: previous declaration of 
'void* aligned_alloc(size_t, size_t)'
 void *aligned_alloc(size_t, size_t);
       ^~~~~~~~~~~~~
---
 libstdc++-v3/configure      | 13 +++++++++++++
 libstdc++-v3/crossconfig.m4 |  1 +
 2 files changed, 14 insertions(+)

diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index f3522ee6666..9fd6197169a 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -66150,6 +66150,19 @@ done
     ;;
   *-netbsd*)
     SECTION_FLAGS='-ffunction-sections -fdata-sections'
+    for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
 
 
   # If we're not using GNU ld, then there's no point in even trying these
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index f0a55c68404..dcc807eb76a 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -203,6 +203,7 @@ case "${host}" in
     ;;
   *-netbsd*)
     SECTION_FLAGS='-ffunction-sections -fdata-sections'
+    AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
     AC_SUBST(SECTION_FLAGS) 
     GLIBCXX_CHECK_LINKER_FEATURES
     AC_DEFINE(HAVE_FINITEF)
-- 
2.17.0

Reply via email to