Skip to content

Commit f07511a

Browse files
[libc] build fix for sigsetjmp (llvm#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.
1 parent a05aeda commit f07511a

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

libc/src/setjmp/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
22
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
3+
add_object_library(
4+
sigsetjmp_epilogue
5+
ALIAS
6+
DEPENDS
7+
.${LIBC_TARGET_OS}.sigsetjmp_epilogue
8+
)
39
endif()
410

5-
add_object_library(
6-
sigsetjmp_epilogue
7-
ALIAS
8-
DEPENDS
9-
.${LIBC_TARGET_OS}.sigsetjmp_epilogue
10-
)
11-
1211
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
1312
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
1413
endif()

libc/src/setjmp/x86_64/sigsetjmp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf buf)) {
3737
3838
.Lnosave:
3939
jmp %P[setjmp])" ::[retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
40-
[extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "i"(setjmp),
41-
[epilogue] "i"(sigsetjmp_epilogue)
40+
[extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "X"(setjmp),
41+
[epilogue] "X"(sigsetjmp_epilogue)
4242
: "eax", "ebx", "ecx");
4343
}
4444
#endif
@@ -60,8 +60,8 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf, int)) {
6060
6161
.Lnosave:
6262
jmp %P[setjmp])" ::[retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
63-
[extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "i"(setjmp),
64-
[epilogue] "i"(sigsetjmp_epilogue)
63+
[extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "X"(setjmp),
64+
[epilogue] "X"(sigsetjmp_epilogue)
6565
: "rax", "rbx");
6666
}
6767

0 commit comments

Comments
 (0)