From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7810) id 39FC63858292; Fri, 17 Jun 2022 08:33:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39FC63858292 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alex Coplan 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 X-Act-Checkin: gcc X-Git-Author: Alex Coplan X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 351a6da872acf4c6095ad16632697ffb9be63851 X-Git-Newrev: f9f91071f809d1d161bb08162ecf17a360fc3418 Message-Id: <20220617083345.39FC63858292@sourceware.org> Date: Fri, 17 Jun 2022 08:33:45 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2022 08:33:45 -0000 https://gcc.gnu.org/g:f9f91071f809d1d161bb08162ecf17a360fc3418 commit f9f91071f809d1d161bb08162ecf17a360fc3418 Author: Alex Coplan 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