Newer
Older
minerva / Toolchain / Patches / gcc / 0006-libstdc-Support-Minerva.patch
@minerva minerva on 13 Jul 4 KB Initial commit
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andreas Kling <awesomekling@gmail.com>
Date: Mon, 16 May 2022 15:08:53 +0200
Subject: [PATCH] libstdc++: Support Minerva
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

During the toolchain build, Minerva libraries are not available, so
we have to manually tell libstdc++ about what our LibC supports.

In most places, we take the Newlib code paths.

Co-Authored-By: Gunnar Beutner <gbeutner@serenityos.org>
Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
Co-Authored-By: Itamar <itamar8910@gmail.com>
Co-Authored-By: James Mintram <me@jamesrm.com>
Co-Authored-By: Martin Bříza <m@rtinbriza.cz>
Co-Authored-By: Nico Weber <thakis@chromium.org>
Co-Authored-By: Philip Herron <herron.philip@googlemail.com>
Co-Authored-By: Shannon Booth <shannon@serenityos.org>
---
 libstdc++-v3/acinclude.m4   |  4 ++--
 libstdc++-v3/configure      | 11 ++++++++---
 libstdc++-v3/configure.host |  3 +++
 libstdc++-v3/crossconfig.m4 |  2 +-
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index a0094c2dd95b43abc80d78cd87b85bc39ddf9eaf..d69a9eac17b868b9c726b3d6b0d80e53d3af68ea 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1792,7 +1792,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
         ac_has_nanosleep=yes
         ac_has_sched_yield=yes
         ;;
-      freebsd*|netbsd*|dragonfly*|rtems*)
+      freebsd*|netbsd*|dragonfly*|rtems*|minerva*)
         ac_has_clock_monotonic=yes
         ac_has_clock_realtime=yes
         ac_has_nanosleep=yes
@@ -2807,7 +2807,7 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
       dragonfly* | freebsd*)
 	enable_clocale_flag=dragonfly
 	;;
-      openbsd*)
+      openbsd* | minerva*)
 	enable_clocale_flag=newlib
 	;;
       *)
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 819a1d82876a156e27a831bdaa695d155c34e31f..0cd50a29ab76d8af432aefdcb07b43f15f70688a 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -12003,6 +12003,11 @@ else
     lt_cv_dlopen_libs=
     ;;
 
+  minerva*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=""
+    ;;
+
   darwin*)
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
@@ -16680,7 +16685,7 @@ fi
       dragonfly* | freebsd*)
 	enable_clocale_flag=dragonfly
 	;;
-      openbsd*)
+      openbsd* | minerva*)
 	enable_clocale_flag=newlib
 	;;
       *)
@@ -21377,7 +21382,7 @@ fi
         ac_has_nanosleep=yes
         ac_has_sched_yield=yes
         ;;
-      freebsd*|netbsd*|dragonfly*|rtems*)
+      freebsd*|netbsd*|dragonfly*|rtems*|minerva*)
         ac_has_clock_monotonic=yes
         ac_has_clock_realtime=yes
         ac_has_nanosleep=yes
@@ -28654,7 +28659,7 @@ case "${host}" in
     # This is a freestanding configuration; there is nothing to do here.
     ;;
 
-  avr*-*-*)
+  avr*-*-* | *minerva*)
     $as_echo "#define HAVE_ACOSF 1" >>confdefs.h
 
     $as_echo "#define HAVE_ASINF 1" >>confdefs.h
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index 253e5a9ad0dbe0698e3672cbee1c89eab8f2702d..45a22282657499d3a3c747f19110f63cbb044995 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -307,6 +307,9 @@ case "${host_os}" in
     # Use libatomic if necessary and avoid libstdc++ specific atomicity support
     atomicity_dir="cpu/generic/atomicity_builtins"
     ;;
+  minerva*)
+    os_include_dir="os/newlib"
+    ;;
   solaris2*)
     os_include_dir="os/solaris"
     ;;
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index b3269cb88e077425be95bfe6c424b08106cab93f..3bba9653675c98ae76caf6cb77bbc483886dc80b 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -9,7 +9,7 @@ case "${host}" in
     # This is a freestanding configuration; there is nothing to do here.
     ;;
 
-  avr*-*-*)
+  avr*-*-* | *minerva*)
     AC_DEFINE(HAVE_ACOSF)
     AC_DEFINE(HAVE_ASINF)
     AC_DEFINE(HAVE_ATAN2F)