-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Reland "[libc] build fix for sigsetjmp (#137047)" #137214
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
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3ef0ab8
Revert "Revert "[libc] build fix for sigsetjmp (#137047)" (#137077)"
SchrodingerZhu 2304226
fix build again
SchrodingerZhu 3591028
[libc] more amendments
SchrodingerZhu 8ce5c04
update jmp_buf.h to always gate this by __linux__
SchrodingerZhu 277eb68
Update libc/include/llvm-libc-types/jmp_buf.h
SchrodingerZhu 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| //===-- Definition of macros for offsetof ---------------------------------===// | ||
| // | ||
| // 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_OFFSETOF_MACROS_H | ||
| #define LLVM_LIBC_HDR_OFFSETOF_MACROS_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
|
|
||
| #include "include/llvm-libc-macros/offsetof-macro.h" | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #define __need_offsetof | ||
| #include <stddef.h> | ||
|
|
||
| #endif // LLVM_LIBC_FULL_BUILD | ||
|
|
||
| #endif // LLVM_LIBC_HDR_OFFSETOF_MACROS_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
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,12 @@ | ||
| add_object_library( | ||
| sigsetjmp_epilogue | ||
| HDRS | ||
| ../sigsetjmp_epilogue.h | ||
| SRCS | ||
| sigsetjmp_epilogue.cpp | ||
| DEPENDS | ||
| libc.src.__support.common | ||
| libc.src.__support.OSUtil.osutil | ||
| libc.hdr.types.jmp_buf | ||
| libc.hdr.types.sigset_t | ||
| ) |
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,25 @@ | ||
| //===-- Implementation of sigsetjmp_epilogue ------------------------------===// | ||
| // | ||
| // 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/setjmp/sigsetjmp_epilogue.h" | ||
| #include "src/__support/OSUtil/syscall.h" | ||
| #include "src/__support/common.h" | ||
| #include <sys/syscall.h> // For syscall numbers. | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
| [[gnu::returns_twice]] int sigsetjmp_epilogue(jmp_buf buffer, int retval) { | ||
| // If set is NULL, then the signal mask is unchanged (i.e., how is | ||
| // ignored), but the current value of the signal mask is nevertheless | ||
| // returned in oldset (if it is not NULL). | ||
| syscall_impl<long>(SYS_rt_sigprocmask, SIG_SETMASK, | ||
| /* set= */ retval ? &buffer->sigmask : nullptr, | ||
| /* old_set= */ retval ? nullptr : &buffer->sigmask, | ||
| sizeof(sigset_t)); | ||
| return retval; | ||
| } | ||
| } // namespace LIBC_NAMESPACE_DECL |
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,23 @@ | ||
| //===-- Implementation of siglongjmp --------------------------------------===// | ||
| // | ||
| // 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/setjmp/siglongjmp.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/setjmp/longjmp.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| // siglongjmp is the same as longjmp. The additional recovery work is done in | ||
| // the epilogue of the sigsetjmp function. | ||
| // TODO: move this inside the TU of longjmp and making it an alias after | ||
| // sigsetjmp is implemented for all architectures. | ||
| LLVM_LIBC_FUNCTION(void, siglongjmp, (jmp_buf buf, int val)) { | ||
| return LIBC_NAMESPACE::longjmp(buf, val); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
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,25 @@ | ||
| //===-- Implementation header for siglongjmp --------------------*- 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_SETJMP_SIGLONGJMP_H | ||
| #define LLVM_LIBC_SRC_SETJMP_SIGLONGJMP_H | ||
|
|
||
| #include "hdr/types/jmp_buf.h" | ||
| #include "src/__support/macros/config.h" | ||
| #include "src/__support/macros/properties/compiler.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| #ifdef LIBC_COMPILER_IS_GCC | ||
| [[gnu::nothrow]] | ||
| #endif | ||
| void siglongjmp(jmp_buf buf, int val); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_SETJMP_SIGLONGJMP_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,26 @@ | ||
| //===-- Implementation header for sigsetjmp ---------------------*- 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_SETJMP_SIGSETJMP_H | ||
| #define LLVM_LIBC_SRC_SETJMP_SIGSETJMP_H | ||
|
|
||
| #include "hdr/types/jmp_buf.h" | ||
| #include "src/__support/macros/config.h" | ||
| #include "src/__support/macros/properties/compiler.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| #ifdef LIBC_COMPILER_IS_GCC | ||
| [[gnu::nothrow]] | ||
| #endif | ||
| [[gnu::returns_twice]] int | ||
| sigsetjmp(sigjmp_buf buf, int savesigs); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_SETJMP_SIGSETJMP_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,19 @@ | ||
| //===-- Implementation header for sigsetjmp epilogue ------------*- 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_SETJMP_SIGSETJMP_EPILOGUE_H | ||
| #define LLVM_LIBC_SRC_SETJMP_SIGSETJMP_EPILOGUE_H | ||
|
|
||
| #include "hdr/types/jmp_buf.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
| [[gnu::returns_twice]] int sigsetjmp_epilogue(jmp_buf buffer, int retval); | ||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_SETJMP_SIGSETJMP_EPILOGUE_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
Oops, something went wrong.
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.