-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] build fix for sigsetjmp #137047
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] build fix for sigsetjmp #137047
Conversation
@llvm/pr-subscribers-libc Author: Schrodinger ZHU Yifan (SchrodingerZhu) ChangesThis PR fixes the build failure due to the
Full diff: https://github.com/llvm/llvm-project/pull/137047.diff 2 Files Affected:
diff --git a/libc/src/setjmp/CMakeLists.txt b/libc/src/setjmp/CMakeLists.txt
index 3a3628bafe7ca..2591319f15240 100644
--- a/libc/src/setjmp/CMakeLists.txt
+++ b/libc/src/setjmp/CMakeLists.txt
@@ -1,14 +1,13 @@
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
+ add_object_library(
+ sigsetjmp_epilogue
+ ALIAS
+ DEPENDS
+ .${LIBC_TARGET_OS}.sigsetjmp_epilogue
+ )
endif()
-add_object_library(
- sigsetjmp_epilogue
- ALIAS
- DEPENDS
- .${LIBC_TARGET_OS}.sigsetjmp_epilogue
-)
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
endif()
diff --git a/libc/src/setjmp/x86_64/sigsetjmp.cpp b/libc/src/setjmp/x86_64/sigsetjmp.cpp
index dc41a71321322..4c97a01822679 100644
--- a/libc/src/setjmp/x86_64/sigsetjmp.cpp
+++ b/libc/src/setjmp/x86_64/sigsetjmp.cpp
@@ -37,8 +37,8 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf buf)) {
.Lnosave:
jmp %P[setjmp])" ::[retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
- [extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "i"(setjmp),
- [epilogue] "i"(sigsetjmp_epilogue)
+ [extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "X"(setjmp),
+ [epilogue] "X"(sigsetjmp_epilogue)
: "eax", "ebx", "ecx");
}
#endif
@@ -60,8 +60,8 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf, int)) {
.Lnosave:
jmp %P[setjmp])" ::[retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
- [extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "i"(setjmp),
- [epilogue] "i"(sigsetjmp_epilogue)
+ [extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "X"(setjmp),
+ [epilogue] "X"(sigsetjmp_epilogue)
: "rax", "rbx");
}
|
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.
Pull Request Overview
This PR fixes a build failure in the sigsetjmp implementation by adjusting inline assembly constraints and avoiding alias target creation when the OS directory for sigsetjmp_epilogue is missing.
- Update inline assembly constraints from "i" to "X" for both sigsetjmp functions
- Bypass alias target creation when the required OS directory is absent
Files not reviewed (1)
- libc/src/setjmp/CMakeLists.txt: Language not supported
Reland `sigsetjmp` patches with build fixes. We wrap every target replying on the epilogue library into conditional checks. --------- Co-authored-by: Petr Hosek <[email protected]>
This PR fixes the build failure due to the `sigsetjmp` implementation. 1. Use a most relaxed input constraint to fix `clang` build. 2. Avoid create alias target if os directory for `sigsetjmp_epilogue` does not exist.
Reland `sigsetjmp` patches with build fixes. We wrap every target replying on the epilogue library into conditional checks. --------- Co-authored-by: Petr Hosek <[email protected]>
This PR fixes the build failure due to the `sigsetjmp` implementation. 1. Use a most relaxed input constraint to fix `clang` build. 2. Avoid create alias target if os directory for `sigsetjmp_epilogue` does not exist.
Reland `sigsetjmp` patches with build fixes. We wrap every target replying on the epilogue library into conditional checks. --------- Co-authored-by: Petr Hosek <[email protected]>
This PR fixes the build failure due to the `sigsetjmp` implementation. 1. Use a most relaxed input constraint to fix `clang` build. 2. Avoid create alias target if os directory for `sigsetjmp_epilogue` does not exist.
Reland `sigsetjmp` patches with build fixes. We wrap every target replying on the epilogue library into conditional checks. --------- Co-authored-by: Petr Hosek <[email protected]>
Reland `sigsetjmp` patches with build fixes. We wrap every target replying on the epilogue library into conditional checks. --------- Co-authored-by: Petr Hosek <[email protected]>
This PR fixes the build failure due to the `sigsetjmp` implementation. 1. Use a most relaxed input constraint to fix `clang` build. 2. Avoid create alias target if os directory for `sigsetjmp_epilogue` does not exist.
Reland `sigsetjmp` patches with build fixes. We wrap every target replying on the epilogue library into conditional checks. --------- Co-authored-by: Petr Hosek <[email protected]>
This PR fixes the build failure due to the
sigsetjmp
implementation.clang
build.sigsetjmp_epilogue
does not exist.