public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] libstdc++: two hacks to get the purecap build going
@ 2022-06-17  8:33 Alex Coplan
  0 siblings, 0 replies; only message in thread
From: Alex Coplan @ 2022-06-17  8:33 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-17  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17  8:33 [gcc(refs/vendors/ARM/heads/morello)] libstdc++: two hacks to get the purecap build going Alex Coplan

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).