-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
K2: add wrappers for libc allocator functions (#1128)
- Loading branch information
Showing
4 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
set(RUNTIME_LIGHT_ALLOCATOR_SRC allocator/runtime-light-allocator.cpp) | ||
set(RUNTIME_LIGHT_ALLOCATOR_SRC allocator/runtime-light-allocator.cpp | ||
allocator/libc-alloc-wrapper.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Compiler for PHP (aka KPHP) | ||
// Copyright (c) 2024 LLC «V Kontakte» | ||
// Distributed under the GPL v3 License, see LICENSE.notice.txt | ||
|
||
#include <cstddef> | ||
|
||
#include "runtime-common/core/utils/kphp-assert-core.h" | ||
|
||
extern "C" void *__wrap_malloc([[maybe_unused]] size_t size) noexcept { | ||
php_critical_error("unexpected use of malloc"); | ||
} | ||
|
||
extern "C" void __wrap_free([[maybe_unused]] void *ptr) noexcept { | ||
php_critical_error("unexpected use of free"); | ||
} | ||
|
||
extern "C" void *__wrap_calloc([[maybe_unused]] size_t nmemb, [[maybe_unused]] size_t size) noexcept { | ||
php_critical_error("unexpected use of calloc"); | ||
} | ||
|
||
extern "C" void *__wrap_realloc([[maybe_unused]] void *ptr, [[maybe_unused]] size_t size) noexcept { | ||
php_critical_error("unexpected use of realloc"); | ||
} |