public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alex Coplan <acoplan@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] libstdc++: two hacks to get the purecap build going
Date: Fri, 17 Jun 2022 08:33:45 +0000 (GMT)	[thread overview]
Message-ID: <20220617083345.39FC63858292@sourceware.org> (raw)

https://gcc.gnu.org/g:f9f91071f809d1d161bb08162ecf17a360fc3418

commit f9f91071f809d1d161bb08162ecf17a360fc3418
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue May 10 10:05:23 2022 +0100

    libstdc++: two hacks to get the purecap build going
    
    This commit disables two static_asserts in libstdc++ that fail when
    building libstdc++ for purecap. This is a compromise to enable progress
    for Morello toolchain development.
    
    In one case (in cow-stdexcept.cc) we turn the build-time failure into a
    runtime failure by substituting the static_assert for __builtin_abort.
    In memory_resource.cc, we simply remove the static_assert. This is a
    known area of libstdc++ that will need porting work for Morello.
    
    This enables us to build a full C++ baremetal cross toolchain for
    Morello (with a purecap multilib).

Diff:
---
 libstdc++-v3/src/c++11/cow-stdexcept.cc   | 7 +++++++
 libstdc++-v3/src/c++17/memory_resource.cc | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc
index 706b39edc85..5e7a4c78eed 100644
--- a/libstdc++-v3/src/c++11/cow-stdexcept.cc
+++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc
@@ -307,6 +307,12 @@ _txnal_cow_string_C1_for_exceptions(void* that, const char* s,
 
 static void* txnal_read_ptr(void* const * ptr)
 {
+#ifdef __CHERI_PURE_CAPABILITY__
+  // MORELLO TODO: FIXME.  Either we need to make this code work for
+  // capabilities or declare transaction-safe exceptions unsupported
+  // (perhaps removing the relevant libstdc++ entry points).
+  __builtin_abort ();
+#else
   static_assert(sizeof(uint64_t) == sizeof(void*)
 		|| sizeof(uint32_t) == sizeof(void*)
 		|| sizeof(uint16_t) == sizeof(void*),
@@ -318,6 +324,7 @@ static void* txnal_read_ptr(void* const * ptr)
 #else
   return (void*)_ITM_RU2((const uint16_t*)ptr);
 #endif
+#endif
 }
 
 // We must access the data pointer in the COW string transactionally because
diff --git a/libstdc++-v3/src/c++17/memory_resource.cc b/libstdc++-v3/src/c++17/memory_resource.cc
index 95352b23537..facc3244538 100644
--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -544,8 +544,11 @@ namespace pmr
   // For 32-bit and 20-bit pointers it's four pointers (16 bytes).
   // For 16-bit pointers it's five pointers (10 bytes).
   // TODO pad 64-bit to 4*sizeof(void*) to avoid splitting across cache lines?
+#ifndef __CHERI_PURE_CAPABILITY__
+  // MORELLO TODO: FIXME.  This code will need adapting for capabilities.
   static_assert(sizeof(chunk)
       == sizeof(bitset::size_type) + sizeof(uint32_t) + 2 * sizeof(void*));
+#endif
 
   // An oversized allocation that doesn't fit in a pool.
   struct big_block


                 reply	other threads:[~2022-06-17  8:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220617083345.39FC63858292@sourceware.org \
    --to=acoplan@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).