| author | |
| committer | |
| log | c32618eed06a4d8c8755f5d7871d0ff7f21091fa |
| tree | 0d7efb4d1011cd0d2e2e1799c4e56ac174ebbbb7 |
| parent | c81170dcd680d94e6f6474874e5dbb5f87712036 |
| signature |
11 files changed, 235 insertions(+), 71 deletions(-)
lib/libcxxabi/include/__cxxabi_config.h+42-23| ... | @@ -14,10 +14,6 @@ | ... | @@ -14,10 +14,6 @@ |
| 14 | #define _LIBCXXABI_ARM_EHABI | 14 | #define _LIBCXXABI_ARM_EHABI |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | #if !defined(__has_attribute) | ||
| 18 | #define __has_attribute(_attribute_) 0 | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #if defined(__clang__) | 17 | #if defined(__clang__) |
| 22 | # define _LIBCXXABI_COMPILER_CLANG | 18 | # define _LIBCXXABI_COMPILER_CLANG |
| 23 | # ifndef __apple_build_version__ | 19 | # ifndef __apple_build_version__ |
| ... | @@ -25,10 +21,6 @@ | ... | @@ -25,10 +21,6 @@ |
| 25 | # endif | 21 | # endif |
| 26 | #elif defined(__GNUC__) | 22 | #elif defined(__GNUC__) |
| 27 | # define _LIBCXXABI_COMPILER_GCC | 23 | # define _LIBCXXABI_COMPILER_GCC |
| 28 | #elif defined(_MSC_VER) | ||
| 29 | # define _LIBCXXABI_COMPILER_MSVC | ||
| 30 | #elif defined(__IBMCPP__) | ||
| 31 | # define _LIBCXXABI_COMPILER_IBM | ||
| 32 | #endif | 24 | #endif |
| 33 | 25 | ||
| 34 | #if defined(_WIN32) | 26 | #if defined(_WIN32) |
| ... | @@ -66,17 +58,7 @@ | ... | @@ -66,17 +58,7 @@ |
| 66 | #endif | 58 | #endif |
| 67 | #endif | 59 | #endif |
| 68 | 60 | ||
| 69 | #if defined(_LIBCXXABI_COMPILER_MSVC) | ||
| 70 | #define _LIBCXXABI_WEAK | ||
| 71 | #else | ||
| 72 | #define _LIBCXXABI_WEAK __attribute__((__weak__)) | 61 | #define _LIBCXXABI_WEAK __attribute__((__weak__)) |
| 73 | #endif | ||
| 74 | |||
| 75 | #if defined(__clang__) | ||
| 76 | #define _LIBCXXABI_COMPILER_CLANG | ||
| 77 | #elif defined(__GNUC__) | ||
| 78 | #define _LIBCXXABI_COMPILER_GCC | ||
| 79 | #endif | ||
| 80 | 62 | ||
| 81 | #if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG) | 63 | #if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG) |
| 82 | #define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi"))) | 64 | #define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi"))) |
| ... | @@ -89,11 +71,7 @@ | ... | @@ -89,11 +71,7 @@ |
| 89 | # define _LIBCXXABI_GUARD_ABI_ARM | 71 | # define _LIBCXXABI_GUARD_ABI_ARM |
| 90 | #endif | 72 | #endif |
| 91 | 73 | ||
| 92 | #if defined(_LIBCXXABI_COMPILER_CLANG) | 74 | #if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L |
| 93 | # if !__has_feature(cxx_exceptions) | ||
| 94 | # define _LIBCXXABI_NO_EXCEPTIONS | ||
| 95 | # endif | ||
| 96 | #elif defined(_LIBCXXABI_COMPILER_GCC) && !defined(__EXCEPTIONS) | ||
| 97 | # define _LIBCXXABI_NO_EXCEPTIONS | 75 | # define _LIBCXXABI_NO_EXCEPTIONS |
| 98 | #endif | 76 | #endif |
| 99 | 77 | ||
| ... | @@ -103,6 +81,47 @@ | ... | @@ -103,6 +81,47 @@ |
| 103 | #define _LIBCXXABI_DTOR_FUNC | 81 | #define _LIBCXXABI_DTOR_FUNC |
| 104 | #endif | 82 | #endif |
| 105 | 83 | ||
| 84 | #if __has_include(<ptrauth.h>) | ||
| 85 | # include <ptrauth.h> | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #if __has_feature(ptrauth_calls) | ||
| 89 | |||
| 90 | // ptrauth_string_discriminator("__cxa_exception::actionRecord") == 0xFC91 | ||
| 91 | # define __ptrauth_cxxabi_action_record __ptrauth(ptrauth_key_process_dependent_data, 1, 0xFC91) | ||
| 92 | |||
| 93 | // ptrauth_string_discriminator("__cxa_exception::languageSpecificData") == 0xE8EE | ||
| 94 | # define __ptrauth_cxxabi_lsd __ptrauth(ptrauth_key_process_dependent_data, 1, 0xE8EE) | ||
| 95 | |||
| 96 | // ptrauth_string_discriminator("__cxa_exception::catchTemp") == 0xFA58 | ||
| 97 | # define __ptrauth_cxxabi_catch_temp_disc 0xFA58 | ||
| 98 | # define __ptrauth_cxxabi_catch_temp_key ptrauth_key_process_dependent_data | ||
| 99 | # define __ptrauth_cxxabi_catch_temp __ptrauth(__ptrauth_cxxabi_catch_temp_key, 1, __ptrauth_cxxabi_catch_temp_disc) | ||
| 100 | |||
| 101 | // ptrauth_string_discriminator("__cxa_exception::adjustedPtr") == 0x99E4 | ||
| 102 | # define __ptrauth_cxxabi_adjusted_ptr __ptrauth(ptrauth_key_process_dependent_data, 1, 0x99E4) | ||
| 103 | |||
| 104 | // ptrauth_string_discriminator("__cxa_exception::unexpectedHandler") == 0x99A9 | ||
| 105 | # define __ptrauth_cxxabi_unexpected_handler __ptrauth(ptrauth_key_function_pointer, 1, 0x99A9) | ||
| 106 | |||
| 107 | // ptrauth_string_discriminator("__cxa_exception::terminateHandler") == 0x0886) | ||
| 108 | # define __ptrauth_cxxabi_terminate_handler __ptrauth(ptrauth_key_function_pointer, 1, 0x886) | ||
| 109 | |||
| 110 | // ptrauth_string_discriminator("__cxa_exception::exceptionDestructor") == 0xC088 | ||
| 111 | # define __ptrauth_cxxabi_exception_destructor __ptrauth(ptrauth_key_function_pointer, 1, 0xC088) | ||
| 112 | |||
| 113 | #else | ||
| 114 | |||
| 115 | # define __ptrauth_cxxabi_action_record | ||
| 116 | # define __ptrauth_cxxabi_lsd | ||
| 117 | # define __ptrauth_cxxabi_catch_temp | ||
| 118 | # define __ptrauth_cxxabi_adjusted_ptr | ||
| 119 | # define __ptrauth_cxxabi_unexpected_handler | ||
| 120 | # define __ptrauth_cxxabi_terminate_handler | ||
| 121 | # define __ptrauth_cxxabi_exception_destructor | ||
| 122 | |||
| 123 | #endif | ||
| 124 | |||
| 106 | #if __cplusplus < 201103L | 125 | #if __cplusplus < 201103L |
| 107 | # define _LIBCXXABI_NOEXCEPT throw() | 126 | # define _LIBCXXABI_NOEXCEPT throw() |
| 108 | #else | 127 | #else |
lib/libcxxabi/src/cxa_exception.cpp+4-2| ... | @@ -192,7 +192,9 @@ void *__cxa_allocate_exception(size_t thrown_size) throw() { | ... | @@ -192,7 +192,9 @@ void *__cxa_allocate_exception(size_t thrown_size) throw() { |
| 192 | std::terminate(); | 192 | std::terminate(); |
| 193 | __cxa_exception *exception_header = | 193 | __cxa_exception *exception_header = |
| 194 | static_cast<__cxa_exception *>((void *)(raw_buffer + header_offset)); | 194 | static_cast<__cxa_exception *>((void *)(raw_buffer + header_offset)); |
| 195 | ::memset(exception_header, 0, actual_size); | 195 | // We warn on memset to a non-trivially castable type. We might want to |
| 196 | // change that diagnostic to not fire on a trivially obvious zero fill. | ||
| 197 | ::memset(static_cast<void*>(exception_header), 0, actual_size); | ||
| 196 | return thrown_object_from_cxa_exception(exception_header); | 198 | return thrown_object_from_cxa_exception(exception_header); |
| 197 | } | 199 | } |
| 198 | 200 | ||
| ... | @@ -226,7 +228,7 @@ __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinf | ... | @@ -226,7 +228,7 @@ __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinf |
| 226 | } | 228 | } |
| 227 | 229 | ||
| 228 | // This function shall allocate a __cxa_dependent_exception and | 230 | // This function shall allocate a __cxa_dependent_exception and |
| 229 | // return a pointer to it. (Really to the object, not past its' end). | 231 | // return a pointer to it. (Really to the object, not past its end). |
| 230 | // Otherwise, it will work like __cxa_allocate_exception. | 232 | // Otherwise, it will work like __cxa_allocate_exception. |
| 231 | void * __cxa_allocate_dependent_exception () { | 233 | void * __cxa_allocate_dependent_exception () { |
| 232 | size_t actual_size = sizeof(__cxa_dependent_exception); | 234 | size_t actual_size = sizeof(__cxa_dependent_exception); |
lib/libcxxabi/src/cxa_exception.h+16-14| ... | @@ -47,10 +47,10 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { | ... | @@ -47,10 +47,10 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { |
| 47 | // In Wasm, a destructor returns its argument | 47 | // In Wasm, a destructor returns its argument |
| 48 | void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); | 48 | void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); |
| 49 | #else | 49 | #else |
| 50 | void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); | 50 | void (_LIBCXXABI_DTOR_FUNC *__ptrauth_cxxabi_exception_destructor exceptionDestructor)(void *); |
| 51 | #endif | 51 | #endif |
| 52 | std::unexpected_handler unexpectedHandler; | 52 | std::unexpected_handler __ptrauth_cxxabi_unexpected_handler unexpectedHandler; |
| 53 | std::terminate_handler terminateHandler; | 53 | std::terminate_handler __ptrauth_cxxabi_terminate_handler terminateHandler; |
| 54 | 54 | ||
| 55 | __cxa_exception *nextException; | 55 | __cxa_exception *nextException; |
| 56 | 56 | ||
| ... | @@ -61,10 +61,10 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { | ... | @@ -61,10 +61,10 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { |
| 61 | int propagationCount; | 61 | int propagationCount; |
| 62 | #else | 62 | #else |
| 63 | int handlerSwitchValue; | 63 | int handlerSwitchValue; |
| 64 | const unsigned char *actionRecord; | 64 | const unsigned char *__ptrauth_cxxabi_action_record actionRecord; |
| 65 | const unsigned char *languageSpecificData; | 65 | const unsigned char *__ptrauth_cxxabi_lsd languageSpecificData; |
| 66 | void *catchTemp; | 66 | void *__ptrauth_cxxabi_catch_temp catchTemp; |
| 67 | void *adjustedPtr; | 67 | void *__ptrauth_cxxabi_adjusted_ptr adjustedPtr; |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | #if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI) | 70 | #if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI) |
| ... | @@ -79,6 +79,8 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { | ... | @@ -79,6 +79,8 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { |
| 79 | // http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html | 79 | // http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html |
| 80 | // The layout of this structure MUST match the layout of __cxa_exception, with | 80 | // The layout of this structure MUST match the layout of __cxa_exception, with |
| 81 | // primaryException instead of referenceCount. | 81 | // primaryException instead of referenceCount. |
| 82 | // The pointer authentication schemas specified here must also match those of | ||
| 83 | // the corresponding members in __cxa_exception. | ||
| 82 | struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { | 84 | struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { |
| 83 | #if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI) | 85 | #if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI) |
| 84 | void* reserve; // padding. | 86 | void* reserve; // padding. |
| ... | @@ -86,9 +88,9 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { | ... | @@ -86,9 +88,9 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { |
| 86 | #endif | 88 | #endif |
| 87 | 89 | ||
| 88 | std::type_info *exceptionType; | 90 | std::type_info *exceptionType; |
| 89 | void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *); | 91 | void (_LIBCXXABI_DTOR_FUNC *__ptrauth_cxxabi_exception_destructor exceptionDestructor)(void *); |
| 90 | std::unexpected_handler unexpectedHandler; | 92 | std::unexpected_handler __ptrauth_cxxabi_unexpected_handler unexpectedHandler; |
| 91 | std::terminate_handler terminateHandler; | 93 | std::terminate_handler __ptrauth_cxxabi_terminate_handler terminateHandler; |
| 92 | 94 | ||
| 93 | __cxa_exception *nextException; | 95 | __cxa_exception *nextException; |
| 94 | 96 | ||
| ... | @@ -99,10 +101,10 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { | ... | @@ -99,10 +101,10 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { |
| 99 | int propagationCount; | 101 | int propagationCount; |
| 100 | #else | 102 | #else |
| 101 | int handlerSwitchValue; | 103 | int handlerSwitchValue; |
| 102 | const unsigned char *actionRecord; | 104 | const unsigned char *__ptrauth_cxxabi_action_record actionRecord; |
| 103 | const unsigned char *languageSpecificData; | 105 | const unsigned char *__ptrauth_cxxabi_lsd languageSpecificData; |
| 104 | void * catchTemp; | 106 | void *__ptrauth_cxxabi_catch_temp catchTemp; |
| 105 | void *adjustedPtr; | 107 | void *__ptrauth_cxxabi_adjusted_ptr adjustedPtr; |
| 106 | #endif | 108 | #endif |
| 107 | 109 | ||
| 108 | #if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI) | 110 | #if !defined(__LP64__) && !defined(_WIN64) && !defined(_LIBCXXABI_ARM_EHABI) |
lib/libcxxabi/src/cxa_personality.cpp+125-12| ... | @@ -20,7 +20,52 @@ | ... | @@ -20,7 +20,52 @@ |
| 20 | #include "cxa_exception.h" | 20 | #include "cxa_exception.h" |
| 21 | #include "cxa_handlers.h" | 21 | #include "cxa_handlers.h" |
| 22 | #include "private_typeinfo.h" | 22 | #include "private_typeinfo.h" |
| 23 | #include "unwind.h" | 23 | |
| 24 | #if __has_feature(ptrauth_calls) | ||
| 25 | |||
| 26 | // CXXABI depends on defintions in libunwind as pointer auth couples the | ||
| 27 | // definitions | ||
| 28 | # include "libunwind.h" | ||
| 29 | |||
| 30 | // The actual value of the discriminators listed below is not important. | ||
| 31 | // The derivation of the constants is only being included for the purpose | ||
| 32 | // of maintaining a record of how they were originally produced. | ||
| 33 | |||
| 34 | // ptrauth_string_discriminator("scan_results::languageSpecificData") == 0xE50D) | ||
| 35 | # define __ptrauth_scan_results_lsd __ptrauth(ptrauth_key_process_dependent_code, 1, 0xE50D) | ||
| 36 | |||
| 37 | // ptrauth_string_discriminator("scan_results::actionRecord") == 0x9823 | ||
| 38 | # define __ptrauth_scan_results_action_record __ptrauth(ptrauth_key_process_dependent_code, 1, 0x9823) | ||
| 39 | |||
| 40 | // scan result is broken up as we have a manual re-sign that requires each component | ||
| 41 | # define __ptrauth_scan_results_landingpad_key ptrauth_key_process_dependent_code | ||
| 42 | // ptrauth_string_discriminator("scan_results::landingPad") == 0xD27C | ||
| 43 | # define __ptrauth_scan_results_landingpad_disc 0xD27C | ||
| 44 | # define __ptrauth_scan_results_landingpad \ | ||
| 45 | __ptrauth(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc) | ||
| 46 | |||
| 47 | // `__ptrauth_restricted_intptr` is a feature of apple clang that predates | ||
| 48 | // support for direct application of `__ptrauth` to integer types. This | ||
| 49 | // guard is necessary to support compilation with those compiler. | ||
| 50 | # if __has_extension(ptrauth_restricted_intptr_qualifier) | ||
| 51 | # define __ptrauth_scan_results_landingpad_intptr \ | ||
| 52 | __ptrauth_restricted_intptr(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc) | ||
| 53 | # else | ||
| 54 | # define __ptrauth_scan_results_landingpad_intptr \ | ||
| 55 | __ptrauth(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc) | ||
| 56 | # endif | ||
| 57 | |||
| 58 | #else | ||
| 59 | # define __ptrauth_scan_results_lsd | ||
| 60 | # define __ptrauth_scan_results_action_record | ||
| 61 | # define __ptrauth_scan_results_landingpad | ||
| 62 | # define __ptrauth_scan_results_landingpad_intptr | ||
| 63 | #endif | ||
| 64 | |||
| 65 | // The functions defined in this file are magic functions called only by the compiler. | ||
| 66 | #ifdef __clang__ | ||
| 67 | # pragma clang diagnostic ignored "-Wmissing-prototypes" | ||
| 68 | #endif | ||
| 24 | 69 | ||
| 25 | // TODO: This is a temporary workaround for libc++abi to recognize that it's being | 70 | // TODO: This is a temporary workaround for libc++abi to recognize that it's being |
| 26 | // built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION | 71 | // built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION |
| ... | @@ -527,12 +572,17 @@ get_thrown_object_ptr(_Unwind_Exception* unwind_exception) | ... | @@ -527,12 +572,17 @@ get_thrown_object_ptr(_Unwind_Exception* unwind_exception) |
| 527 | namespace | 572 | namespace |
| 528 | { | 573 | { |
| 529 | 574 | ||
| 575 | typedef const uint8_t *__ptrauth_scan_results_lsd lsd_ptr_t; | ||
| 576 | typedef const uint8_t *__ptrauth_scan_results_action_record action_ptr_t; | ||
| 577 | typedef uintptr_t __ptrauth_scan_results_landingpad_intptr landing_pad_t; | ||
| 578 | typedef void *__ptrauth_scan_results_landingpad landing_pad_ptr_t; | ||
| 579 | |||
| 530 | struct scan_results | 580 | struct scan_results |
| 531 | { | 581 | { |
| 532 | int64_t ttypeIndex; // > 0 catch handler, < 0 exception spec handler, == 0 a cleanup | 582 | int64_t ttypeIndex; // > 0 catch handler, < 0 exception spec handler, == 0 a cleanup |
| 533 | const uint8_t* actionRecord; // Currently unused. Retained to ease future maintenance. | 583 | action_ptr_t actionRecord; // Currently unused. Retained to ease future maintenance. |
| 534 | const uint8_t* languageSpecificData; // Needed only for __cxa_call_unexpected | 584 | lsd_ptr_t languageSpecificData; // Needed only for __cxa_call_unexpected |
| 535 | uintptr_t landingPad; // null -> nothing found, else something found | 585 | landing_pad_t landingPad; // null -> nothing found, else something found |
| 536 | void* adjustedPtr; // Used in cxa_exception.cpp | 586 | void* adjustedPtr; // Used in cxa_exception.cpp |
| 537 | _Unwind_Reason_Code reason; // One of _URC_FATAL_PHASE1_ERROR, | 587 | _Unwind_Reason_Code reason; // One of _URC_FATAL_PHASE1_ERROR, |
| 538 | // _URC_FATAL_PHASE2_ERROR, | 588 | // _URC_FATAL_PHASE2_ERROR, |
| ... | @@ -557,7 +607,23 @@ set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, | ... | @@ -557,7 +607,23 @@ set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, |
| 557 | reinterpret_cast<uintptr_t>(unwind_exception)); | 607 | reinterpret_cast<uintptr_t>(unwind_exception)); |
| 558 | _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), | 608 | _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), |
| 559 | static_cast<uintptr_t>(results.ttypeIndex)); | 609 | static_cast<uintptr_t>(results.ttypeIndex)); |
| 610 | #if __has_feature(ptrauth_calls) | ||
| 611 | auto stackPointer = _Unwind_GetGR(context, UNW_REG_SP); | ||
| 612 | // We manually re-sign the IP as the __ptrauth qualifiers cannot | ||
| 613 | // express the required relationship with the destination address | ||
| 614 | const auto existingDiscriminator = | ||
| 615 | ptrauth_blend_discriminator(&results.landingPad, | ||
| 616 | __ptrauth_scan_results_landingpad_disc); | ||
| 617 | unw_word_t newIP /* opaque __ptrauth(ptrauth_key_return_address, stackPointer, 0) */ = | ||
| 618 | (unw_word_t)ptrauth_auth_and_resign(*(void* const*)&results.landingPad, | ||
| 619 | __ptrauth_scan_results_landingpad_key, | ||
| 620 | existingDiscriminator, | ||
| 621 | ptrauth_key_return_address, | ||
| 622 | stackPointer); | ||
| 623 | _Unwind_SetIP(context, newIP); | ||
| 624 | #else | ||
| 560 | _Unwind_SetIP(context, results.landingPad); | 625 | _Unwind_SetIP(context, results.landingPad); |
| 626 | #endif | ||
| 561 | } | 627 | } |
| 562 | 628 | ||
| 563 | /* | 629 | /* |
| ... | @@ -691,12 +757,12 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, | ... | @@ -691,12 +757,12 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions, |
| 691 | // The call sites are ordered in increasing value of start | 757 | // The call sites are ordered in increasing value of start |
| 692 | uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding); | 758 | uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding); |
| 693 | uintptr_t length = readEncodedPointer(&callSitePtr, callSiteEncoding); | 759 | uintptr_t length = readEncodedPointer(&callSitePtr, callSiteEncoding); |
| 694 | uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding); | 760 | landing_pad_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding); |
| 695 | uintptr_t actionEntry = readULEB128(&callSitePtr); | 761 | uintptr_t actionEntry = readULEB128(&callSitePtr); |
| 696 | if ((start <= ipOffset) && (ipOffset < (start + length))) | 762 | if ((start <= ipOffset) && (ipOffset < (start + length))) |
| 697 | #else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ | 763 | #else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| 698 | // ip is 1-based index into this table | 764 | // ip is 1-based index into this table |
| 699 | uintptr_t landingPad = readULEB128(&callSitePtr); | 765 | landing_pad_t landingPad = readULEB128(&callSitePtr); |
| 700 | uintptr_t actionEntry = readULEB128(&callSitePtr); | 766 | uintptr_t actionEntry = readULEB128(&callSitePtr); |
| 701 | if (--ip == 0) | 767 | if (--ip == 0) |
| 702 | #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ | 768 | #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__ |
| ... | @@ -903,6 +969,57 @@ _UA_CLEANUP_PHASE | ... | @@ -903,6 +969,57 @@ _UA_CLEANUP_PHASE |
| 903 | */ | 969 | */ |
| 904 | 970 | ||
| 905 | #if !defined(_LIBCXXABI_ARM_EHABI) | 971 | #if !defined(_LIBCXXABI_ARM_EHABI) |
| 972 | |||
| 973 | // We use these helper functions to work around the behavior of casting between | ||
| 974 | // integers (even those that are authenticated) and authenticated pointers. | ||
| 975 | // Because the schemas being used are address discriminated we cannot use a | ||
| 976 | // trivial value union to coerce the types so instead we perform the re-signing | ||
| 977 | // manually. | ||
| 978 | using __cxa_catch_temp_type = decltype(__cxa_exception::catchTemp); | ||
| 979 | static inline void set_landing_pad(scan_results& results, | ||
| 980 | const __cxa_catch_temp_type& source) { | ||
| 981 | #if __has_feature(ptrauth_calls) | ||
| 982 | const uintptr_t sourceDiscriminator = | ||
| 983 | ptrauth_blend_discriminator(&source, __ptrauth_cxxabi_catch_temp_disc); | ||
| 984 | const uintptr_t targetDiscriminator = | ||
| 985 | ptrauth_blend_discriminator(&results.landingPad, | ||
| 986 | __ptrauth_scan_results_landingpad_disc); | ||
| 987 | uintptr_t reauthenticatedLandingPad = | ||
| 988 | (uintptr_t)ptrauth_auth_and_resign(*reinterpret_cast<void* const*>(&source), | ||
| 989 | __ptrauth_cxxabi_catch_temp_key, | ||
| 990 | sourceDiscriminator, | ||
| 991 | __ptrauth_scan_results_landingpad_key, | ||
| 992 | targetDiscriminator); | ||
| 993 | memmove(reinterpret_cast<void *>(&results.landingPad), | ||
| 994 | reinterpret_cast<void *>(&reauthenticatedLandingPad), | ||
| 995 | sizeof(reauthenticatedLandingPad)); | ||
| 996 | #else | ||
| 997 | results.landingPad = reinterpret_cast<landing_pad_t>(source); | ||
| 998 | #endif | ||
| 999 | } | ||
| 1000 | |||
| 1001 | static inline void get_landing_pad(__cxa_catch_temp_type &dest, | ||
| 1002 | const scan_results &results) { | ||
| 1003 | #if __has_feature(ptrauth_calls) | ||
| 1004 | const uintptr_t sourceDiscriminator = | ||
| 1005 | ptrauth_blend_discriminator(&results.landingPad, | ||
| 1006 | __ptrauth_scan_results_landingpad_disc); | ||
| 1007 | const uintptr_t targetDiscriminator = | ||
| 1008 | ptrauth_blend_discriminator(&dest, __ptrauth_cxxabi_catch_temp_disc); | ||
| 1009 | uintptr_t reauthenticatedPointer = | ||
| 1010 | (uintptr_t)ptrauth_auth_and_resign(*reinterpret_cast<void* const*>(&results.landingPad), | ||
| 1011 | __ptrauth_scan_results_landingpad_key, | ||
| 1012 | sourceDiscriminator, | ||
| 1013 | __ptrauth_cxxabi_catch_temp_key, | ||
| 1014 | targetDiscriminator); | ||
| 1015 | memmove(reinterpret_cast<void *>(&dest), | ||
| 1016 | reinterpret_cast<void *>(&reauthenticatedPointer), | ||
| 1017 | sizeof(reauthenticatedPointer)); | ||
| 1018 | #else | ||
| 1019 | dest = reinterpret_cast<__cxa_catch_temp_type>(results.landingPad); | ||
| 1020 | #endif | ||
| 1021 | } | ||
| 1022 | |||
| 906 | #ifdef __WASM_EXCEPTIONS__ | 1023 | #ifdef __WASM_EXCEPTIONS__ |
| 907 | _Unwind_Reason_Code __gxx_personality_wasm0 | 1024 | _Unwind_Reason_Code __gxx_personality_wasm0 |
| 908 | #elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) | 1025 | #elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) |
| ... | @@ -935,8 +1052,7 @@ __gxx_personality_v0 | ... | @@ -935,8 +1052,7 @@ __gxx_personality_v0 |
| 935 | results.ttypeIndex = exception_header->handlerSwitchValue; | 1052 | results.ttypeIndex = exception_header->handlerSwitchValue; |
| 936 | results.actionRecord = exception_header->actionRecord; | 1053 | results.actionRecord = exception_header->actionRecord; |
| 937 | results.languageSpecificData = exception_header->languageSpecificData; | 1054 | results.languageSpecificData = exception_header->languageSpecificData; |
| 938 | results.landingPad = | 1055 | set_landing_pad(results, exception_header->catchTemp); |
| 939 | reinterpret_cast<uintptr_t>(exception_header->catchTemp); | ||
| 940 | results.adjustedPtr = exception_header->adjustedPtr; | 1056 | results.adjustedPtr = exception_header->adjustedPtr; |
| 941 | 1057 | ||
| 942 | // Jump to the handler. | 1058 | // Jump to the handler. |
| ... | @@ -970,7 +1086,7 @@ __gxx_personality_v0 | ... | @@ -970,7 +1086,7 @@ __gxx_personality_v0 |
| 970 | exc->handlerSwitchValue = static_cast<int>(results.ttypeIndex); | 1086 | exc->handlerSwitchValue = static_cast<int>(results.ttypeIndex); |
| 971 | exc->actionRecord = results.actionRecord; | 1087 | exc->actionRecord = results.actionRecord; |
| 972 | exc->languageSpecificData = results.languageSpecificData; | 1088 | exc->languageSpecificData = results.languageSpecificData; |
| 973 | exc->catchTemp = reinterpret_cast<void*>(results.landingPad); | 1089 | get_landing_pad(exc->catchTemp, results); |
| 974 | exc->adjustedPtr = results.adjustedPtr; | 1090 | exc->adjustedPtr = results.adjustedPtr; |
| 975 | #ifdef __WASM_EXCEPTIONS__ | 1091 | #ifdef __WASM_EXCEPTIONS__ |
| 976 | // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the | 1092 | // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the |
| ... | @@ -1009,9 +1125,6 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, | ... | @@ -1009,9 +1125,6 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, |
| 1009 | 1125 | ||
| 1010 | #else | 1126 | #else |
| 1011 | 1127 | ||
| 1012 | extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, | ||
| 1013 | _Unwind_Context*); | ||
| 1014 | |||
| 1015 | // Helper function to unwind one frame. | 1128 | // Helper function to unwind one frame. |
| 1016 | // ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the | 1129 | // ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the |
| 1017 | // personality routine should update the virtual register set (VRS) according to the | 1130 | // personality routine should update the virtual register set (VRS) according to the |
lib/libcxxabi/src/cxa_thread_atexit.cpp+2-1| ... | @@ -106,6 +106,7 @@ namespace { | ... | @@ -106,6 +106,7 @@ namespace { |
| 106 | 106 | ||
| 107 | #endif // HAVE___CXA_THREAD_ATEXIT_IMPL | 107 | #endif // HAVE___CXA_THREAD_ATEXIT_IMPL |
| 108 | 108 | ||
| 109 | #if defined(__linux__) || defined(__Fuchsia__) | ||
| 109 | extern "C" { | 110 | extern "C" { |
| 110 | 111 | ||
| 111 | _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() { | 112 | _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() { |
| ... | @@ -140,6 +141,6 @@ extern "C" { | ... | @@ -140,6 +141,6 @@ extern "C" { |
| 140 | } | 141 | } |
| 141 | #endif // HAVE___CXA_THREAD_ATEXIT_IMPL | 142 | #endif // HAVE___CXA_THREAD_ATEXIT_IMPL |
| 142 | } | 143 | } |
| 143 | |||
| 144 | } // extern "C" | 144 | } // extern "C" |
| 145 | #endif // defined(__linux__) || defined(__Fuchsia__) | ||
| 145 | } // namespace __cxxabiv1 | 146 | } // namespace __cxxabiv1 |
lib/libcxxabi/src/demangle/DemangleConfig.h+4| ... | @@ -115,4 +115,8 @@ | ... | @@ -115,4 +115,8 @@ |
| 115 | #define DEMANGLE_NAMESPACE_BEGIN namespace { namespace itanium_demangle { | 115 | #define DEMANGLE_NAMESPACE_BEGIN namespace { namespace itanium_demangle { |
| 116 | #define DEMANGLE_NAMESPACE_END } } | 116 | #define DEMANGLE_NAMESPACE_END } } |
| 117 | 117 | ||
| 118 | // The DEMANGLE_ABI macro resolves to nothing when building libc++abi. Only | ||
| 119 | // the llvm copy defines DEMANGLE_ABI as a visibility attribute. | ||
| 120 | #define DEMANGLE_ABI | ||
| 121 | |||
| 118 | #endif // LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H | 122 | #endif // LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H |
lib/libcxxabi/src/demangle/ItaniumDemangle.h+9-6| ... | @@ -1366,7 +1366,7 @@ public: | ... | @@ -1366,7 +1366,7 @@ public: |
| 1366 | template <typename Fn> void match(Fn F) const { F(Name, Params, Requires); } | 1366 | template <typename Fn> void match(Fn F) const { F(Name, Params, Requires); } |
| 1367 | 1367 | ||
| 1368 | void printLeft(OutputBuffer &OB) const override { | 1368 | void printLeft(OutputBuffer &OB) const override { |
| 1369 | ScopedOverride<unsigned> LT(OB.GtIsGt, 0); | 1369 | ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true); |
| 1370 | OB += "template<"; | 1370 | OB += "template<"; |
| 1371 | Params.printWithComma(OB); | 1371 | Params.printWithComma(OB); |
| 1372 | OB += "> typename "; | 1372 | OB += "> typename "; |
| ... | @@ -1550,7 +1550,7 @@ public: | ... | @@ -1550,7 +1550,7 @@ public: |
| 1550 | NodeArray getParams() { return Params; } | 1550 | NodeArray getParams() { return Params; } |
| 1551 | 1551 | ||
| 1552 | void printLeft(OutputBuffer &OB) const override { | 1552 | void printLeft(OutputBuffer &OB) const override { |
| 1553 | ScopedOverride<unsigned> LT(OB.GtIsGt, 0); | 1553 | ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true); |
| 1554 | OB += "<"; | 1554 | OB += "<"; |
| 1555 | Params.printWithComma(OB); | 1555 | Params.printWithComma(OB); |
| 1556 | OB += ">"; | 1556 | OB += ">"; |
| ... | @@ -1824,7 +1824,7 @@ public: | ... | @@ -1824,7 +1824,7 @@ public: |
| 1824 | 1824 | ||
| 1825 | void printDeclarator(OutputBuffer &OB) const { | 1825 | void printDeclarator(OutputBuffer &OB) const { |
| 1826 | if (!TemplateParams.empty()) { | 1826 | if (!TemplateParams.empty()) { |
| 1827 | ScopedOverride<unsigned> LT(OB.GtIsGt, 0); | 1827 | ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true); |
| 1828 | OB += "<"; | 1828 | OB += "<"; |
| 1829 | TemplateParams.printWithComma(OB); | 1829 | TemplateParams.printWithComma(OB); |
| 1830 | OB += ">"; | 1830 | OB += ">"; |
| ... | @@ -1885,7 +1885,9 @@ public: | ... | @@ -1885,7 +1885,9 @@ public: |
| 1885 | } | 1885 | } |
| 1886 | 1886 | ||
| 1887 | void printLeft(OutputBuffer &OB) const override { | 1887 | void printLeft(OutputBuffer &OB) const override { |
| 1888 | bool ParenAll = OB.isGtInsideTemplateArgs() && | 1888 | // If we're printing a '<' inside of a template argument, and we haven't |
| 1889 | // yet parenthesized the expression, do so now. | ||
| 1890 | bool ParenAll = !OB.isInParensInTemplateArgs() && | ||
| 1889 | (InfixOperator == ">" || InfixOperator == ">>"); | 1891 | (InfixOperator == ">" || InfixOperator == ">>"); |
| 1890 | if (ParenAll) | 1892 | if (ParenAll) |
| 1891 | OB.printOpen(); | 1893 | OB.printOpen(); |
| ... | @@ -2061,7 +2063,7 @@ public: | ... | @@ -2061,7 +2063,7 @@ public: |
| 2061 | void printLeft(OutputBuffer &OB) const override { | 2063 | void printLeft(OutputBuffer &OB) const override { |
| 2062 | OB += CastKind; | 2064 | OB += CastKind; |
| 2063 | { | 2065 | { |
| 2064 | ScopedOverride<unsigned> LT(OB.GtIsGt, 0); | 2066 | ScopedOverride<bool> LT(OB.TemplateTracker.InsideTemplate, true); |
| 2065 | OB += "<"; | 2067 | OB += "<"; |
| 2066 | OB.printLeft(*To); | 2068 | OB.printLeft(*To); |
| 2067 | OB += ">"; | 2069 | OB += ">"; |
| ... | @@ -3049,7 +3051,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser { | ... | @@ -3049,7 +3051,8 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser { |
| 3049 | Node *parse(bool ParseParams = true); | 3051 | Node *parse(bool ParseParams = true); |
| 3050 | }; | 3052 | }; |
| 3051 | 3053 | ||
| 3052 | const char* parse_discriminator(const char* first, const char* last); | 3054 | DEMANGLE_ABI const char *parse_discriminator(const char *first, |
| 3055 | const char *last); | ||
| 3053 | 3056 | ||
| 3054 | // <name> ::= <nested-name> // N | 3057 | // <name> ::= <nested-name> // N |
| 3055 | // ::= <local-name> # See Scope Encoding below // Z | 3058 | // ::= <local-name> # See Scope Encoding below // Z |
lib/libcxxabi/src/demangle/Utility.h+21-7| ... | @@ -81,7 +81,7 @@ public: | ... | @@ -81,7 +81,7 @@ public: |
| 81 | OutputBuffer(const OutputBuffer &) = delete; | 81 | OutputBuffer(const OutputBuffer &) = delete; |
| 82 | OutputBuffer &operator=(const OutputBuffer &) = delete; | 82 | OutputBuffer &operator=(const OutputBuffer &) = delete; |
| 83 | 83 | ||
| 84 | virtual ~OutputBuffer() {} | 84 | virtual ~OutputBuffer() = default; |
| 85 | 85 | ||
| 86 | operator std::string_view() const { | 86 | operator std::string_view() const { |
| 87 | return std::string_view(Buffer, CurrentPosition); | 87 | return std::string_view(Buffer, CurrentPosition); |
| ... | @@ -104,18 +104,32 @@ public: | ... | @@ -104,18 +104,32 @@ public: |
| 104 | unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max(); | 104 | unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max(); |
| 105 | unsigned CurrentPackMax = std::numeric_limits<unsigned>::max(); | 105 | unsigned CurrentPackMax = std::numeric_limits<unsigned>::max(); |
| 106 | 106 | ||
| 107 | /// When zero, we're printing template args and '>' needs to be parenthesized. | 107 | struct { |
| 108 | /// Use a counter so we can simply increment inside parentheses. | 108 | /// The depth of '(' and ')' inside the currently printed template |
| 109 | unsigned GtIsGt = 1; | 109 | /// arguments. |
| 110 | unsigned ParenDepth = 0; | ||
| 110 | 111 | ||
| 111 | bool isGtInsideTemplateArgs() const { return GtIsGt == 0; } | 112 | /// True if we're currently printing a template argument. |
| 113 | bool InsideTemplate = false; | ||
| 114 | } TemplateTracker; | ||
| 115 | |||
| 116 | /// Returns true if we're currently between a '(' and ')' when printing | ||
| 117 | /// template args. | ||
| 118 | bool isInParensInTemplateArgs() const { | ||
| 119 | return TemplateTracker.ParenDepth > 0; | ||
| 120 | } | ||
| 121 | |||
| 122 | /// Returns true if we're printing template args. | ||
| 123 | bool isInsideTemplateArgs() const { return TemplateTracker.InsideTemplate; } | ||
| 112 | 124 | ||
| 113 | void printOpen(char Open = '(') { | 125 | void printOpen(char Open = '(') { |
| 114 | GtIsGt++; | 126 | if (isInsideTemplateArgs()) |
| 127 | TemplateTracker.ParenDepth++; | ||
| 115 | *this += Open; | 128 | *this += Open; |
| 116 | } | 129 | } |
| 117 | void printClose(char Close = ')') { | 130 | void printClose(char Close = ')') { |
| 118 | GtIsGt--; | 131 | if (isInsideTemplateArgs()) |
| 132 | TemplateTracker.ParenDepth--; | ||
| 119 | *this += Close; | 133 | *this += Close; |
| 120 | } | 134 | } |
| 121 | 135 |
lib/libcxxabi/src/fallback_malloc.cpp+1-1| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | #endif | 16 | #endif |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| 19 | #include <__memory/aligned_alloc.h> | 19 | #include "include/aligned_alloc.h" // from libc++ |
| 20 | #include <__assert> | 20 | #include <__assert> |
| 21 | #include <stdlib.h> // for malloc, calloc, free | 21 | #include <stdlib.h> // for malloc, calloc, free |
| 22 | #include <string.h> // for memset | 22 | #include <string.h> // for memset |
lib/libcxxabi/src/private_typeinfo.cpp+6| ... | @@ -831,6 +831,10 @@ bool __pointer_to_member_type_info::can_catch_nested( | ... | @@ -831,6 +831,10 @@ bool __pointer_to_member_type_info::can_catch_nested( |
| 831 | #pragma clang diagnostic ignored "-Wmissing-field-initializers" | 831 | #pragma clang diagnostic ignored "-Wmissing-field-initializers" |
| 832 | #endif | 832 | #endif |
| 833 | 833 | ||
| 834 | #pragma GCC diagnostic push | ||
| 835 | // __dynamic_cast is called by the compiler, so there is no prototype | ||
| 836 | #pragma GCC diagnostic ignored "-Wmissing-prototypes" | ||
| 837 | |||
| 834 | // __dynamic_cast | 838 | // __dynamic_cast |
| 835 | 839 | ||
| 836 | // static_ptr: pointer to an object of type static_type; nonnull, and since the | 840 | // static_ptr: pointer to an object of type static_type; nonnull, and since the |
| ... | @@ -953,6 +957,8 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type, | ... | @@ -953,6 +957,8 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type, |
| 953 | return const_cast<void*>(dst_ptr); | 957 | return const_cast<void*>(dst_ptr); |
| 954 | } | 958 | } |
| 955 | 959 | ||
| 960 | #pragma GCC diagnostic pop | ||
| 961 | |||
| 956 | #ifdef __clang__ | 962 | #ifdef __clang__ |
| 957 | #pragma clang diagnostic pop | 963 | #pragma clang diagnostic pop |
| 958 | #endif | 964 | #endif |
lib/libcxxabi/src/stdlib_new_delete.cpp+5-5| ... | @@ -8,8 +8,8 @@ | ... | @@ -8,8 +8,8 @@ |
| 8 | 8 | ||
| 9 | #include "__cxxabi_config.h" | 9 | #include "__cxxabi_config.h" |
| 10 | #include "abort_message.h" | 10 | #include "abort_message.h" |
| 11 | #include "include/aligned_alloc.h" // from libc++ | ||
| 11 | #include "include/overridable_function.h" // from libc++ | 12 | #include "include/overridable_function.h" // from libc++ |
| 12 | #include <__memory/aligned_alloc.h> | ||
| 13 | #include <cstddef> | 13 | #include <cstddef> |
| 14 | #include <cstdlib> | 14 | #include <cstdlib> |
| 15 | #include <new> | 15 | #include <new> |
| ... | @@ -63,7 +63,7 @@ static void* operator_new_impl(std::size_t size) { | ... | @@ -63,7 +63,7 @@ static void* operator_new_impl(std::size_t size) { |
| 63 | return p; | 63 | return p; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | _LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new, (std::size_t size)) _THROW_BAD_ALLOC { | 66 | OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC { |
| 67 | void* p = operator_new_impl(size); | 67 | void* p = operator_new_impl(size); |
| 68 | if (p == nullptr) | 68 | if (p == nullptr) |
| 69 | __throw_bad_alloc_shim(); | 69 | __throw_bad_alloc_shim(); |
| ... | @@ -94,7 +94,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { | ... | @@ -94,7 +94,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { |
| 94 | #endif | 94 | #endif |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | _LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size)) _THROW_BAD_ALLOC { return ::operator new(size); } | 97 | OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); } |
| 98 | 98 | ||
| 99 | _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { | 99 | _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept { |
| 100 | #if !_LIBCPP_HAS_EXCEPTIONS | 100 | #if !_LIBCPP_HAS_EXCEPTIONS |
| ... | @@ -154,7 +154,7 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm | ... | @@ -154,7 +154,7 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm |
| 154 | return p; | 154 | return p; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | _LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new, (std::size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC { | 157 | OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { |
| 158 | void* p = operator_new_aligned_impl(size, alignment); | 158 | void* p = operator_new_aligned_impl(size, alignment); |
| 159 | if (p == nullptr) | 159 | if (p == nullptr) |
| 160 | __throw_bad_alloc_shim(); | 160 | __throw_bad_alloc_shim(); |
| ... | @@ -185,7 +185,7 @@ _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const s | ... | @@ -185,7 +185,7 @@ _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const s |
| 185 | # endif | 185 | # endif |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | _LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC { | 188 | OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC { |
| 189 | return ::operator new(size, alignment); | 189 | return ::operator new(size, alignment); |
| 190 | } | 190 | } |
| 191 | 191 |