-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Merged
Merged
[libc] Add proxy headers to handle memory allocation associated with the header `#include <stdlib.h> #114690
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8d779e0
add memory allocation and free
cd6da88
fomat code
1196fb3
address review
4b40e74
format code
a9f959f
address review
48c4deb
address review
3b93df7
address review
87da5a2
address review
d96acb1
address review
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,52 @@ | ||
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 | ||
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.
|
||
libc.hdr.types.size_t | ||
) | ||
|
||
add_proxy_header_library( | ||
realloc | ||
HDRS | ||
realloc.h | ||
DEPENDS | ||
libc.hdr.stdlib_overlay | ||
FULL_BUILD_DEPENDS | ||
libc.include.stdlib | ||
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.
|
||
libc.hdr.types.size_t | ||
) | ||
|
||
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 | ||
) |
This file contains hidden or 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,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 |
This file contains hidden or 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,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 |
This file contains hidden or 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,21 @@ | ||
//===-- 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 | ||
extern "C" void free(void *); | ||
|
||
#else // Overlay mode | ||
|
||
#include "hdr/stdlib_overlay.h" | ||
|
||
#endif | ||
|
||
#endif |
This file contains hidden or 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,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 |
This file contains hidden or 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,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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.