diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 23bd9b9..93e00ed 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -42,6 +42,8 @@ #include #endif +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -864,7 +866,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION at(size_type __n) const { if (__n >= this->size()) - __throw_out_of_range(__N("basic_string::at")); + __throw_out_of_range(__EXCSTR(__N("basic_string::at"))); return _M_data()[__n]; } @@ -883,7 +885,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION at(size_type __n) { if (__n >= size()) - __throw_out_of_range(__N("basic_string::at")); + __throw_out_of_range(__EXCSTR(__N("basic_string::at"))); _M_leak(); return _M_data()[__n]; } @@ -1099,7 +1101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string& assign(const basic_string& __str, size_type __pos, size_type __n) { return this->assign(__str._M_data() - + __str._M_check(__pos, "basic_string::assign"), + + __str._M_check(__pos, __EXCSTR("basic_string::assign")), __str._M_limit(__pos, __n)); } /** @@ -1255,7 +1257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { return this->insert(__pos1, __str._M_data() - + __str._M_check(__pos2, "basic_string::insert"), + + __str._M_check(__pos2, __EXCSTR("basic_string::insert")), __str._M_limit(__pos2, __n)); } /** @@ -1317,7 +1319,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ basic_string& insert(size_type __pos, size_type __n, _CharT __c) - { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), + { return _M_replace_aux(_M_check(__pos, __EXCSTR("basic_string::insert")), size_type(0), __n, __c); } /** @@ -1361,7 +1363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string& erase(size_type __pos = 0, size_type __n = npos) { - _M_mutate(_M_check(__pos, "basic_string::erase"), + _M_mutate(_M_check(__pos, __EXCSTR("basic_string::erase")), _M_limit(__pos, __n), size_type(0)); return *this; } @@ -1451,7 +1453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { return this->replace(__pos1, __n1, __str._M_data() - + __str._M_check(__pos2, "basic_string::replace"), + + __str._M_check(__pos2, __EXCSTR("basic_string::replace")), __str._M_limit(__pos2, __n2)); } /** @@ -1518,7 +1520,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ basic_string& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) - { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), + { return _M_replace_aux(_M_check(__pos, __EXCSTR("basic_string::replace")), _M_limit(__pos, __n1), __n2, __c); } /** @@ -2205,7 +2207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string substr(size_type __pos = 0, size_type __n = npos) const { return basic_string(*this, - _M_check(__pos, "basic_string::substr"), __n); } + _M_check(__pos, __EXCSTR("basic_string::substr")), __n); } /** * @brief Compare to a string. @@ -3108,4 +3110,6 @@ _GLIBCXX_END_NAMESPACE_VERSION #endif // C++11 +#undef __EXCSTR + #endif /* _BASIC_STRING_H */ diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index 317eb74..17a95ca 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -39,6 +39,8 @@ #pragma GCC system_header +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + #include namespace std _GLIBCXX_VISIBILITY(default) @@ -130,7 +132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // NB: Not required, but considered best practice. if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end) - __throw_logic_error(__N("basic_string::_S_construct null not valid")); + __throw_logic_error(__EXCSTR(__N("basic_string::_S_construct null not valid"))); const size_type __dnew = static_cast(std::distance(__beg, __end)); @@ -184,7 +186,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string(const basic_string& __str, size_type __pos, size_type __n) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, - "basic_string::basic_string"), + __EXCSTR("basic_string::basic_string")), __str._M_data() + __str._M_limit(__pos, __n) + __pos, _Alloc()), _Alloc()) { } @@ -195,7 +197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_type __n, const _Alloc& __a) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, - "basic_string::basic_string"), + __EXCSTR("basic_string::basic_string")), __str._M_data() + __str._M_limit(__pos, __n) + __pos, __a), __a) { } @@ -259,7 +261,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION assign(const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); - _M_check_length(this->size(), __n, "basic_string::assign"); + _M_check_length(this->size(), __n, __EXCSTR("basic_string::assign")); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(size_type(0), this->size(), __s, __n); else @@ -282,7 +284,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { if (__n) { - _M_check_length(size_type(0), __n, "basic_string::append"); + _M_check_length(size_type(0), __n, __EXCSTR("basic_string::append")); const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) this->reserve(__len); @@ -300,7 +302,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __glibcxx_requires_string_len(__s, __n); if (__n) { - _M_check_length(size_type(0), __n, "basic_string::append"); + _M_check_length(size_type(0), __n, __EXCSTR("basic_string::append")); const size_type __len = __n + this->size(); if (__len > this->capacity() || _M_rep()->_M_is_shared()) { @@ -341,7 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string<_CharT, _Traits, _Alloc>:: append(const basic_string& __str, size_type __pos, size_type __n) { - __str._M_check(__pos, "basic_string::append"); + __str._M_check(__pos, __EXCSTR("basic_string::append")); __n = __str._M_limit(__pos, __n); if (__n) { @@ -360,8 +362,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION insert(size_type __pos, const _CharT* __s, size_type __n) { __glibcxx_requires_string_len(__s, __n); - _M_check(__pos, "basic_string::insert"); - _M_check_length(size_type(0), __n, "basic_string::insert"); + _M_check(__pos, __EXCSTR("basic_string::insert")); + _M_check_length(size_type(0), __n, __EXCSTR("basic_string::insert")); if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(__pos, size_type(0), __s, __n); else @@ -415,9 +417,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_type __n2) { __glibcxx_requires_string_len(__s, __n2); - _M_check(__pos, "basic_string::replace"); + _M_check(__pos, __EXCSTR("basic_string::replace")); __n1 = _M_limit(__pos, __n1); - _M_check_length(__n1, __n2, "basic_string::replace"); + _M_check_length(__n1, __n2, __EXCSTR("basic_string::replace")); bool __left; if (_M_disjunct(__s) || _M_rep()->_M_is_shared()) return _M_replace_safe(__pos, __n1, __s, __n2); @@ -549,7 +551,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 83. String::npos vs. string::max_size() if (__capacity > _S_max_size) - __throw_length_error(__N("basic_string::_S_create")); + __throw_length_error(__EXCSTR(__N("basic_string::_S_create"))); // The standard places no restriction on allocating more memory // than is strictly needed within this layer at the moment or as @@ -640,7 +642,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION resize(size_type __n, _CharT __c) { const size_type __size = this->size(); - _M_check_length(__size, __n, "basic_string::resize"); + _M_check_length(__size, __n, __EXCSTR("basic_string::resize")); if (__size < __n) this->append(__n - __size, __c); else if (__n < __size) @@ -657,7 +659,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { const basic_string __s(__k1, __k2); const size_type __n1 = __i2 - __i1; - _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch"); + _M_check_length(__n1, __s.size(), __EXCSTR("basic_string::_M_replace_dispatch")); return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(), __s.size()); } @@ -668,7 +670,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c) { - _M_check_length(__n1, __n2, "basic_string::_M_replace_aux"); + _M_check_length(__n1, __n2, __EXCSTR("basic_string::_M_replace_aux")); _M_mutate(__pos1, __n1, __n2); if (__n2) _M_assign(_M_data() + __pos1, __n2, __c); @@ -722,7 +724,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string<_CharT, _Traits, _Alloc>:: copy(_CharT* __s, size_type __n, size_type __pos) const { - _M_check(__pos, "basic_string::copy"); + _M_check(__pos, __EXCSTR("basic_string::copy")); __n = _M_limit(__pos, __n); __glibcxx_requires_string_len(__s, __n); if (__n) @@ -915,7 +917,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string<_CharT, _Traits, _Alloc>:: compare(size_type __pos, size_type __n, const basic_string& __str) const { - _M_check(__pos, "basic_string::compare"); + _M_check(__pos, __EXCSTR("basic_string::compare")); __n = _M_limit(__pos, __n); const size_type __osize = __str.size(); const size_type __len = std::min(__n, __osize); @@ -931,8 +933,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const { - _M_check(__pos1, "basic_string::compare"); - __str._M_check(__pos2, "basic_string::compare"); + _M_check(__pos1, __EXCSTR("basic_string::compare")); + __str._M_check(__pos2, __EXCSTR("basic_string::compare")); __n1 = _M_limit(__pos1, __n1); __n2 = __str._M_limit(__pos2, __n2); const size_type __len = std::min(__n1, __n2); @@ -964,7 +966,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION compare(size_type __pos, size_type __n1, const _CharT* __s) const { __glibcxx_requires_string(__s); - _M_check(__pos, "basic_string::compare"); + _M_check(__pos, __EXCSTR("basic_string::compare")); __n1 = _M_limit(__pos, __n1); const size_type __osize = traits_type::length(__s); const size_type __len = std::min(__n1, __osize); @@ -981,7 +983,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_type __n2) const { __glibcxx_requires_string_len(__s, __n2); - _M_check(__pos, "basic_string::compare"); + _M_check(__pos, __EXCSTR("basic_string::compare")); __n1 = _M_limit(__pos, __n1); const size_type __len = std::min(__n1, __n2); int __r = traits_type::compare(_M_data() + __pos, __s, __len); @@ -1163,4 +1165,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#undef __EXCSTR + #endif diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc index 0882fe6..078f50d 100644 --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -56,6 +56,8 @@ #ifndef _VECTOR_TCC #define _VECTOR_TCC 1 +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER @@ -66,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER reserve(size_type __n) { if (__n > this->max_size()) - __throw_length_error(__N("vector::reserve")); + __throw_length_error(__EXCSTR(__N("vector::reserve"))); if (this->capacity() < __n) { const size_type __old_size = size(); @@ -340,7 +342,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(size_type(1), "vector::_M_insert_aux"); + _M_check_len(size_type(1), __EXCSTR("vector::_M_insert_aux")); const size_type __elems_before = __position - begin(); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); @@ -400,7 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_emplace_back_aux(_Args&&... __args) { const size_type __len = - _M_check_len(size_type(1), "vector::_M_emplace_back_aux"); + _M_check_len(size_type(1), __EXCSTR("vector::_M_emplace_back_aux")); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try @@ -478,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(__n, "vector::_M_fill_insert"); + _M_check_len(__n, __EXCSTR("vector::_M_fill_insert")); const size_type __elems_before = __position - begin(); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); @@ -544,7 +546,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(__n, "vector::_M_default_append"); + _M_check_len(__n, __EXCSTR("vector::_M_default_append")); const size_type __old_size = this->size(); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); @@ -647,7 +649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(__n, "vector::_M_range_insert"); + _M_check_len(__n, __EXCSTR("vector::_M_range_insert")); pointer __new_start(this->_M_allocate(__len)); pointer __new_finish(__new_start); __try @@ -716,7 +718,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(__n, "vector::_M_fill_insert"); + _M_check_len(__n, __EXCSTR("vector::_M_fill_insert")); _Bit_type * __q = this->_M_allocate(__len); iterator __i = _M_copy_aligned(begin(), __position, iterator(__q, 0)); @@ -750,7 +752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(__n, "vector::_M_insert_range"); + _M_check_len(__n, __EXCSTR("vector::_M_insert_range")); _Bit_type * __q = this->_M_allocate(__len); iterator __i = _M_copy_aligned(begin(), __position, iterator(__q, 0)); @@ -778,7 +780,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER else { const size_type __len = - _M_check_len(size_type(1), "vector::_M_insert_aux"); + _M_check_len(size_type(1), __EXCSTR("vector::_M_insert_aux")); _Bit_type * __q = this->_M_allocate(__len); iterator __i = _M_copy_aligned(begin(), __position, iterator(__q, 0)); @@ -853,6 +855,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#undef __EXCSTR + #endif // C++11 #endif /* _VECTOR_TCC */ diff --git a/libstdc++-v3/libsupc++/bad_alloc.cc b/libstdc++-v3/libsupc++/bad_alloc.cc index 4891114..1e0a8be 100644 --- a/libstdc++-v3/libsupc++/bad_alloc.cc +++ b/libstdc++-v3/libsupc++/bad_alloc.cc @@ -25,10 +25,12 @@ #include "new" +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + std::bad_alloc::~bad_alloc() _GLIBCXX_USE_NOEXCEPT { } const char* std::bad_alloc::what() const _GLIBCXX_USE_NOEXCEPT { - return "std::bad_alloc"; + return __EXCSTR("std::bad_alloc"); } diff --git a/libstdc++-v3/libsupc++/bad_cast.cc b/libstdc++-v3/libsupc++/bad_cast.cc index ad72084..ea0105a 100644 --- a/libstdc++-v3/libsupc++/bad_cast.cc +++ b/libstdc++-v3/libsupc++/bad_cast.cc @@ -23,6 +23,8 @@ #include +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std { bad_cast::~bad_cast() _GLIBCXX_USE_NOEXCEPT { } @@ -30,7 +32,7 @@ bad_cast::~bad_cast() _GLIBCXX_USE_NOEXCEPT { } const char* bad_cast::what() const _GLIBCXX_USE_NOEXCEPT { - return "std::bad_cast"; + return __EXCSTR("std::bad_cast"); } } // namespace std diff --git a/libstdc++-v3/libsupc++/bad_typeid.cc b/libstdc++-v3/libsupc++/bad_typeid.cc index 73cbf27..09fa5e8 100644 --- a/libstdc++-v3/libsupc++/bad_typeid.cc +++ b/libstdc++-v3/libsupc++/bad_typeid.cc @@ -23,6 +23,8 @@ #include +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std { bad_typeid::~bad_typeid() _GLIBCXX_USE_NOEXCEPT { } @@ -30,7 +32,7 @@ bad_typeid::~bad_typeid() _GLIBCXX_USE_NOEXCEPT { } const char* bad_typeid::what() const _GLIBCXX_USE_NOEXCEPT { - return "std::bad_typeid"; + return __EXCSTR("std::bad_typeid"); } } // namespace std diff --git a/libstdc++-v3/libsupc++/eh_exception.cc b/libstdc++-v3/libsupc++/eh_exception.cc index 4fd8711..4f13761 100644 --- a/libstdc++-v3/libsupc++/eh_exception.cc +++ b/libstdc++-v3/libsupc++/eh_exception.cc @@ -26,6 +26,8 @@ #include "exception" #include +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + std::exception::~exception() _GLIBCXX_USE_NOEXCEPT { } std::bad_exception::~bad_exception() _GLIBCXX_USE_NOEXCEPT { } @@ -40,11 +42,11 @@ std::exception::what() const _GLIBCXX_USE_NOEXCEPT // NB: Another elegant option would be returning typeid(*this).name() // and not overriding what() in bad_exception, bad_alloc, etc. In // that case, however, mangled names would be returned, PR 14493. - return "std::exception"; + return __EXCSTR("std::exception"); } const char* std::bad_exception::what() const _GLIBCXX_USE_NOEXCEPT { - return "std::bad_exception"; + return __EXCSTR("std::bad_exception"); } diff --git a/libstdc++-v3/src/c++11/functional.cc b/libstdc++-v3/src/c++11/functional.cc index 8d81f60..3186719 100644 --- a/libstdc++-v3/src/c++11/functional.cc +++ b/libstdc++-v3/src/c++11/functional.cc @@ -24,6 +24,8 @@ #include +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -32,7 +34,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const char* bad_function_call::what() const noexcept - { return "bad_function_call"; } + { return __EXCSTR("bad_function_call"); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc index ca5714a..bb7f1f0 100644 --- a/libstdc++-v3/src/c++11/shared_ptr.cc +++ b/libstdc++-v3/src/c++11/shared_ptr.cc @@ -24,6 +24,8 @@ #include +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -32,7 +34,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char const* bad_weak_ptr::what() const noexcept - { return "bad_weak_ptr"; } + { return __EXCSTR("bad_weak_ptr"); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 69c6e27..5dbce77 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -63,6 +63,8 @@ #include #endif +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER @@ -791,7 +793,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_range_check(size_type __n) const { if (__n >= this->size()) - __throw_out_of_range(__N("vector::_M_range_check")); + __throw_out_of_range(__EXCSTR(__N("vector::_M_range_check"))); } public: @@ -1454,4 +1456,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std +#undef __EXCSTR + #endif /* _STL_VECTOR_H */ diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc index 89c5ef7..5b316c7 100644 --- a/libstdc++-v3/include/bits/deque.tcc +++ b/libstdc++-v3/include/bits/deque.tcc @@ -56,6 +56,8 @@ #ifndef _DEQUE_TCC #define _DEQUE_TCC 1 +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER @@ -824,7 +826,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_new_elements_at_front(size_type __new_elems) { if (this->max_size() - this->size() < __new_elems) - __throw_length_error(__N("deque::_M_new_elements_at_front")); + __throw_length_error(__EXCSTR(__N("deque::_M_new_elements_at_front"))); const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1) / _S_buffer_size()); @@ -849,7 +851,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_new_elements_at_back(size_type __new_elems) { if (this->max_size() - this->size() < __new_elems) - __throw_length_error(__N("deque::_M_new_elements_at_back")); + __throw_length_error(__EXCSTR(__N("deque::_M_new_elements_at_back"))); const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1) / _S_buffer_size()); @@ -1062,6 +1064,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif +#undef __EXCSTR + _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 6f9b843..3276a87 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -31,6 +31,8 @@ #ifndef _HASHTABLE_POLICY_H #define _HASHTABLE_POLICY_H 1 +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -541,7 +543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __node_type* __p = __h->_M_find_node(__n, __k, __code); if (!__p) - __throw_out_of_range(__N("_Map_base::at")); + __throw_out_of_range(__EXCSTR(__N("_Map_base::at"))); return (__p->_M_v).second; } @@ -561,7 +563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __node_type* __p = __h->_M_find_node(__n, __k, __code); if (!__p) - __throw_out_of_range(__N("_Map_base::at")); + __throw_out_of_range(__EXCSTR(__N("_Map_base::at"))); return (__p->_M_v).second; } @@ -1667,4 +1669,6 @@ _GLIBCXX_END_NAMESPACE_VERSION } // namespace __detail } // namespace std +#undef __EXCSTR + #endif // _HASHTABLE_POLICY_H diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 422a98a..0d869b7 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -60,6 +60,8 @@ #include #endif +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER @@ -777,7 +779,7 @@ template _M_range_check(size_type __n) const { if (__n >= this->size()) - __throw_out_of_range(__N("vector::_M_range_check")); + __throw_out_of_range(__EXCSTR(__N("vector::_M_range_check"))); } public: @@ -793,7 +795,7 @@ template reserve(size_type __n) { if (__n > max_size()) - __throw_length_error(__N("vector::reserve")); + __throw_length_error(__EXCSTR(__N("vector::reserve"))); if (capacity() < __n) _M_reallocate(__n); } diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 596760c..dbfe8c6 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -61,6 +61,8 @@ #include #endif +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { namespace __detail @@ -1583,7 +1585,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { if (std::__alloc_neq:: _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator())) - __throw_runtime_error(__N("list::_M_check_equal_allocators")); + __throw_runtime_error(__EXCSTR(__N("list::_M_check_equal_allocators"))); } }; @@ -1665,4 +1667,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std +#undef __EXCSTR + #endif /* _STL_LIST_H */ diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index d05e4b9..39e5721 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -63,6 +63,8 @@ #include #endif +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_CONTAINER @@ -502,7 +504,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { iterator __i = lower_bound(__k); if (__i == end() || key_comp()(__k, (*__i).first)) - __throw_out_of_range(__N("map::at")); + __throw_out_of_range(__EXCSTR(__N("map::at"))); return (*__i).second; } @@ -511,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { const_iterator __i = lower_bound(__k); if (__i == end() || key_comp()(__k, (*__i).first)) - __throw_out_of_range(__N("map::at")); + __throw_out_of_range(__EXCSTR(__N("map::at"))); return (*__i).second; } @@ -1018,4 +1020,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std +#undef __EXCSTR + #endif /* _STL_MAP_H */ diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc index 453c687..e86e369 100644 --- a/libstdc++-v3/src/c++11/system_error.cc +++ b/libstdc++-v3/src/c++11/system_error.cc @@ -27,6 +27,9 @@ #include #include #include +#include + +#define __EXCSTR(s) (__extension__({static const char __c[] __attribute__((section(".irom.exceptiontext,\"MS\",@progbits,1#"))) = (s); &__c[0];})) namespace { @@ -36,14 +39,15 @@ namespace { virtual const char* name() const noexcept - { return "generic"; } + { return __EXCSTR("generic"); } virtual string message(int i) const { // XXX locale issues: how does one get or set loc. // _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc) - return string(strerror(i)); + char buff[16]; + return string(itoa(i, buff, 10)); } }; @@ -51,14 +55,15 @@ namespace { virtual const char* name() const noexcept - { return "system"; } + { return __EXCSTR("system"); } virtual string message(int i) const { // XXX locale issues: how does one get or set loc. // _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc) - return string(strerror(i)); + char buff[16]; + return string(itoa(i, buff, 10)); } };