[libc-commits] [libc] f07511a - [libc] build fix for sigsetjmp (#137047)
via libc-commits
libc-commits at lists.llvm.org
Wed Apr 23 12:50:59 PDT 2025
Author: Schrodinger ZHU Yifan
Date: 2025-04-23T15:50:55-04:00
New Revision: f07511a0e0d2ac9bee9ae12a9ad68e279e352634
URL: https://github.com/llvm/llvm-project/commit/f07511a0e0d2ac9bee9ae12a9ad68e279e352634
DIFF: https://github.com/llvm/llvm-project/commit/f07511a0e0d2ac9bee9ae12a9ad68e279e352634.diff
LOG: [libc] build fix for sigsetjmp (#137047)
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.
Added:
Modified:
libc/src/setjmp/CMakeLists.txt
libc/src/setjmp/x86_64/sigsetjmp.cpp
Removed:
################################################################################
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");
}
More information about the libc-commits
mailing list