mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-25 07:29:33 -05:00
explicitly export C++ allocator overrides
This doesn't make any difference for GCC, but these aren't replaced outside of the library with Clang without explicitly exporting them.
This commit is contained in:
parent
e6e9ac1fc9
commit
4716ff5b92
20
new.cc
20
new.cc
@ -41,42 +41,42 @@ static inline void *new_impl(size_t size, bool nothrow) {
|
|||||||
return handle_out_of_memory(size, nothrow);
|
return handle_out_of_memory(size, nothrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new(size_t size) {
|
EXPORT void *operator new(size_t size) {
|
||||||
return new_impl(size, false);
|
return new_impl(size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t size) {
|
EXPORT void *operator new[](size_t size) {
|
||||||
return new_impl(size, false);
|
return new_impl(size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new(size_t size, const std::nothrow_t &) noexcept {
|
EXPORT void *operator new(size_t size, const std::nothrow_t &) noexcept {
|
||||||
return new_impl(size, true);
|
return new_impl(size, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t size, const std::nothrow_t &) noexcept {
|
EXPORT void *operator new[](size_t size, const std::nothrow_t &) noexcept {
|
||||||
return new_impl(size, true);
|
return new_impl(size, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *ptr) noexcept {
|
EXPORT void operator delete(void *ptr) noexcept {
|
||||||
h_free(ptr);
|
h_free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete[](void *ptr) noexcept {
|
EXPORT void operator delete[](void *ptr) noexcept {
|
||||||
h_free(ptr);
|
h_free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *ptr, const std::nothrow_t &) noexcept {
|
EXPORT void operator delete(void *ptr, const std::nothrow_t &) noexcept {
|
||||||
h_free(ptr);
|
h_free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete[](void *ptr, const std::nothrow_t &) noexcept {
|
EXPORT void operator delete[](void *ptr, const std::nothrow_t &) noexcept {
|
||||||
h_free(ptr);
|
h_free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *ptr, size_t size) noexcept {
|
EXPORT void operator delete(void *ptr, size_t size) noexcept {
|
||||||
h_free_sized(ptr, size);
|
h_free_sized(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete[](void *ptr, size_t size) noexcept {
|
EXPORT void operator delete[](void *ptr, size_t size) noexcept {
|
||||||
h_free_sized(ptr, size);
|
h_free_sized(ptr, size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user