From f68963c09232f56ee793ab12b902f16c45af0214 Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Tue, 6 Dec 2016 17:58:10 +0000 Subject: [PATCH] Add #ifdef case for 16 bits in cow-stdexcept.cc Added #ifdef case for when void* is 16 bits so it compiles in AVR target. 2016-12-06 Felipe Magno de Almeida * src/c++11/cow-stdexcept.cc: Add special case for 16 bit pointers. From-SVN: r243310 --- libstdc++-v3/ChangeLog | 2 ++ libstdc++-v3/src/c++11/cow-stdexcept.cc | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index face139ee0f..138a0208b20 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,7 @@ 2016-12-06 Felipe Magno de Almeida + * src/c++11/cow-stdexcept.cc: Add special case for 16 bit pointers. + * crossconfig.m4: Add avr target for cross-compilation. * configure: Regenerate. diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index 31a89dfd554..641b372ccf8 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -208,6 +208,8 @@ extern void* _ZGTtnaX (size_t sz) __attribute__((weak)); extern void _ZGTtdlPv (void* ptr) __attribute__((weak)); extern uint8_t _ITM_RU1(const uint8_t *p) ITM_REGPARM __attribute__((weak)); +extern uint16_t _ITM_RU2(const uint16_t *p) + ITM_REGPARM __attribute__((weak)); extern uint32_t _ITM_RU4(const uint32_t *p) ITM_REGPARM __attribute__((weak)); extern uint64_t _ITM_RU8(const uint64_t *p) @@ -272,12 +274,15 @@ _txnal_cow_string_C1_for_exceptions(void* that, const char* s, static void* txnal_read_ptr(void* const * ptr) { static_assert(sizeof(uint64_t) == sizeof(void*) - || sizeof(uint32_t) == sizeof(void*), - "Pointers must be 32 bits or 64 bits wide"); + || sizeof(uint32_t) == sizeof(void*) + || sizeof(uint16_t) == sizeof(void*), + "Pointers must be 16 bits, 32 bits or 64 bits wide"); #if __UINTPTR_MAX__ == __UINT64_MAX__ return (void*)_ITM_RU8((const uint64_t*)ptr); -#else +#elif __UINTPTR_MAX__ == __UINT32_MAX__ return (void*)_ITM_RU4((const uint32_t*)ptr); +#else + return (void*)_ITM_RU2((const uint16_t*)ptr); #endif } -- 2.30.2