* [PATCH 4/9] libstdc++ changes for ia16
@ 2017-04-01 16:48 Andrew Jenner
2017-04-03 14:55 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Jenner @ 2017-04-01 16:48 UTC (permalink / raw)
To: GCC Patches, libstdc++
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
2017-04-01 Andrew Jenner <andrew@codesourcery.com>
* src/c++11/cow-stdexcept.cc (_ITM_RU2): Declare.
(txnal_read_ptr): Allow 16-bit pointers.
* src/c++11/codecvt.cc (read_utf8_code_point): Handle 16-bit int.
[-- Attachment #2: gcc_ia16_libstdc++.patch --]
[-- Type: text/x-patch, Size: 2207 bytes --]
Index: libstdc++-v3/src/c++11/cow-stdexcept.cc
===================================================================
--- libstdc++-v3/src/c++11/cow-stdexcept.cc (revision 475331)
+++ libstdc++-v3/src/c++11/cow-stdexcept.cc (revision 475455)
@@ -208,6 +208,8 @@ extern void* _ZGTtnaX (size_t sz) __attr
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
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 bit or 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
}
Index: libstdc++-v3/src/c++11/codecvt.cc
===================================================================
--- libstdc++-v3/src/c++11/codecvt.cc (revision 475331)
+++ libstdc++-v3/src/c++11/codecvt.cc (revision 475455)
@@ -177,7 +177,7 @@ namespace
unsigned char c3 = from.next[2];
if ((c3 & 0xC0) != 0x80)
return invalid_mb_sequence;
- char32_t c = (c1 << 12) + (c2 << 6) + c3 - 0xE2080;
+ char32_t c = ((char32_t)c1 << 12) + (c2 << 6) + c3 - 0xE2080;
if (c <= maxcode)
from.next += 3;
return c;
@@ -199,7 +199,8 @@ namespace
unsigned char c4 = from.next[3];
if ((c4 & 0xC0) != 0x80)
return invalid_mb_sequence;
- char32_t c = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4 - 0x3C82080;
+ char32_t c = ((char32_t)c1 << 18) + ((char32_t)c2 << 12) + (c3 << 6)
+ + c4 - 0x3C82080;
if (c <= maxcode)
from.next += 4;
return c;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 4/9] libstdc++ changes for ia16
2017-04-01 16:48 [PATCH 4/9] libstdc++ changes for ia16 Andrew Jenner
@ 2017-04-03 14:55 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2017-04-03 14:55 UTC (permalink / raw)
To: Andrew Jenner; +Cc: GCC Patches, libstdc++
On 01/04/17 17:48 +0100, Andrew Jenner wrote:
> * src/c++11/cow-stdexcept.cc (_ITM_RU2): Declare.
> (txnal_read_ptr): Allow 16-bit pointers.
> * src/c++11/codecvt.cc (read_utf8_code_point): Handle 16-bit int.
OK for Stage 1, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-03 14:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 16:48 [PATCH 4/9] libstdc++ changes for ia16 Andrew Jenner
2017-04-03 14:55 ` Jonathan Wakely
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).