-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] implement quick exit function #93621
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1bfb3ba
[libc] implement quick exit function
aaryanshukla 60298a6
addressed comments regarding quick exit function
aaryanshukla c69c2ba
addressing comments to quick exit function
aaryanshukla 4190cb0
fixed no_stack_proctector brackets and noreturn, including formatting
aaryanshukla 2949dbd
added internal in front of exit for quick_exit
aaryanshukla 453836d
updated build.BAZEL, changed all quick_exit to exit
aaryanshukla 391d44e
changed quick_exit to exit in cmakefiles in gpu and baremetal
aaryanshukla 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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ add_object_library( | |
baremetal_util | ||
SRCS | ||
io.cpp | ||
quick_exit.cpp | ||
exit.cpp | ||
HDRS | ||
io.h | ||
DEPENDS | ||
|
9 changes: 6 additions & 3 deletions
9
...__support/OSUtil/baremetal/quick_exit.cpp → libc/src/__support/OSUtil/baremetal/exit.cpp
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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
//===----- Baremetal implementation of a quick exit function ----*- C++ -*-===// | ||
//===----- Baremetal implementation of an exit function ----*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
aaryanshukla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#include "src/__support/OSUtil/quick_exit.h" | ||
#include "src/__support/OSUtil/exit.h" | ||
|
||
// This is intended to be provided by the vendor. | ||
extern "C" [[noreturn]] void __llvm_libc_quick_exit(int status); | ||
|
||
namespace LIBC_NAMESPACE { | ||
namespace internal { | ||
|
||
[[noreturn]] void quick_exit(int status) { __llvm_libc_quick_exit(status); } | ||
[[noreturn]] void exit(int status) { __llvm_libc_quick_exit(status); } | ||
|
||
aaryanshukla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} // namespace internal | ||
|
||
} // namespace LIBC_NAMESPACE |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
add_object_library( | ||
gpu_util | ||
SRCS | ||
quick_exit.cpp | ||
exit.cpp | ||
io.cpp | ||
HDRS | ||
io.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
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
aaryanshukla marked this conversation as resolved.
Show resolved
Hide resolved
|
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
aaryanshukla marked this conversation as resolved.
Show resolved
Hide resolved
|
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 @@ | ||
//===-- Implementation of quick_exit --------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "src/stdlib/quick_exit.h" | ||
#include "src/__support/OSUtil/exit.h" | ||
#include "src/__support/common.h" | ||
|
||
// extern "C" void __cxa_finalize(void *); | ||
namespace LIBC_NAMESPACE { | ||
|
||
[[noreturn]] LLVM_LIBC_FUNCTION(void, quick_exit, (int status)) { | ||
//__cxa_finalize(nullptr); | ||
aaryanshukla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
internal::exit(status); | ||
} | ||
|
||
} // namespace LIBC_NAMESPACE |
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,17 @@ | ||
//===-- Implementation header for quick_exit -------------------*- C++ -*-===// | ||
// | ||
// 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_SRC_STDLIB_QUICK_EXIT_H | ||
#define LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H | ||
namespace LIBC_NAMESPACE { | ||
|
||
[[noreturn]] void quick_exit(int status); | ||
|
||
} // namespace LIBC_NAMESPACE | ||
|
||
#endif // LLVM_LIBC_SRC_STDLIB_QUICK_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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//===-- Unittests for quick_exit ------------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "src/stdlib/quick_exit.h" | ||
#include "test/UnitTest/Test.h" | ||
|
||
TEST(LlvmLibcStdlib, quick_exit) { | ||
EXPECT_EXITS([] { LIBC_NAMESPACE::quick_exit(1); }, 1); | ||
EXPECT_EXITS([] { LIBC_NAMESPACE::quick_exit(65); }, 65); | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: align the length of this line.