-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc] Add proxy headers to handle memory allocation associated with the header `#include <stdlib.h> #114690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] Add proxy headers to handle memory allocation associated with the header `#include <stdlib.h> #114690
Changes from 8 commits
8d779e0
cd6da88
1196fb3
4b40e74
a9f959f
48c4deb
3b93df7
87da5a2
d96acb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| add_proxy_header_library( | ||
| aligned_alloc | ||
| HDRS | ||
| aligned_alloc.h | ||
| DEPENDS | ||
| libc.hdr.stdlib_overlay | ||
| FULL_BUILD_DEPENDS | ||
| libc.include.stdlib | ||
| libc.hdr.types.size_t | ||
| ) | ||
|
|
||
| add_proxy_header_library( | ||
| malloc | ||
| HDRS | ||
| malloc.h | ||
| DEPENDS | ||
| libc.hdr.stdlib_overlay | ||
| FULL_BUILD_DEPENDS | ||
| libc.include.stdlib | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ) | ||
|
|
||
| add_proxy_header_library( | ||
| realloc | ||
| HDRS | ||
| realloc.h | ||
| DEPENDS | ||
| libc.hdr.stdlib_overlay | ||
| FULL_BUILD_DEPENDS | ||
| libc.include.stdlib | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ) | ||
|
|
||
| add_proxy_header_library( | ||
| free | ||
| HDRS | ||
| free.h | ||
| DEPENDS | ||
| libc.hdr.stdlib_overlay | ||
| FULL_BUILD_DEPENDS | ||
| libc.include.stdlib | ||
| ) | ||
|
|
||
| add_proxy_header_library( | ||
| _Exit | ||
| HDRS | ||
| _Exit.h | ||
| DEPENDS | ||
| libc.hdr.stdlib_overlay | ||
| FULL_BUILD_DEPENDS | ||
| libc.include.stdlib | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Definition of the _Exit proxy -------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_HDR_FUNC_EXIT_H | ||
| #define LLVM_LIBC_HDR_FUNC_EXIT_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
| extern "C" void _Exit(int); | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include "hdr/stdlib_overlay.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif // LLVM_LIBC_HDR_EXIT_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of the aligned_alloc.h proxy ---------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_HDR_FUNC_ALIGNED_ALLOC_H | ||
| #define LLVM_LIBC_HDR_FUNC_ALIGNED_ALLOC_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
| #include "hdr/types/size_t.h" | ||
| extern "C" void *aligned_alloc(size_t, size_t); | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include "hdr/stdlib_overlay.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of the free.h proxy ------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_HDR_FUNC_FREE_H | ||
| #define LLVM_LIBC_HDR_FUNC_FREE_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
| #include "hdr/types/size_t.h" | ||
|
||
| extern "C" void free(void *); | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include "hdr/stdlib_overlay.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of the malloc.h proxy ----------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_HDR_FUNC_MALLOC_H | ||
| #define LLVM_LIBC_HDR_FUNC_MALLOC_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
| #include "hdr/types/size_t.h" | ||
| extern "C" void *malloc(size_t); | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include "hdr/stdlib_overlay.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of the realloc.h proxy ---------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_HDR_FUNC_REALLOC_H | ||
| #define LLVM_LIBC_HDR_FUNC_REALLOC_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
| #include "hdr/types/size_t.h" | ||
| extern "C" void *realloc(void *ptr, size_t new_size); | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include "hdr/stdlib_overlay.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -387,6 +387,7 @@ if(LLVM_LIBC_FULL_BUILD) | |
| libc.src.stdlib.exit | ||
| libc.src.stdlib.atexit | ||
| libc.src.__support.CPP.array | ||
| libc.hdr.func._Exit | ||
|
||
| ) | ||
|
|
||
| add_libc_test( | ||
|
|
@@ -401,6 +402,7 @@ if(LLVM_LIBC_FULL_BUILD) | |
| libc.src.stdlib.quick_exit | ||
| libc.src.stdlib.at_quick_exit | ||
| libc.src.__support.CPP.array | ||
| libc.hdr.func._Exit | ||
|
||
| ) | ||
|
|
||
| add_libc_test( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.