[libc-commits] [libc] [libc] build fix for sigsetjmp (PR #137047)
via libc-commits
libc-commits at lists.llvm.org
Wed Apr 23 12:48:19 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Schrodinger ZHU Yifan (SchrodingerZhu)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/137047.diff
2 Files Affected:
- (modified) libc/src/setjmp/CMakeLists.txt (+6-7)
- (modified) libc/src/setjmp/x86_64/sigsetjmp.cpp (+4-4)
``````````diff
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");
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/137047
More information about the libc-commits
mailing list