Skip to content

Commit 0d00b6b

Browse files
authored
Revert "[libc] build fix for sigsetjmp (#137047)" (#137077)
This reverts commit f07511a. This reverts commit 5bb4cf9. It caused a CMake configuration issue.
1 parent d72f1f9 commit 0d00b6b

19 files changed

+8
-414
lines changed

libc/config/linux/x86_64/entrypoints.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1049,8 +1049,6 @@ if(LLVM_LIBC_FULL_BUILD)
10491049
# setjmp.h entrypoints
10501050
libc.src.setjmp.longjmp
10511051
libc.src.setjmp.setjmp
1052-
libc.src.setjmp.siglongjmp
1053-
libc.src.setjmp.sigsetjmp
10541052

10551053
# stdio.h entrypoints
10561054
libc.src.stdio.clearerr

libc/hdr/CMakeLists.txt

-9
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,5 @@ add_proxy_header_library(
223223
libc.include.wchar
224224
)
225225

226-
# offsetof is a macro inside compiler resource header stddef.h
227-
add_proxy_header_library(
228-
offsetof_macros
229-
HDRS
230-
offsetof_macros.h
231-
FULL_BUILD_DEPENDS
232-
libc.include.llvm-libc-macros.offsetof_macro
233-
)
234-
235226
add_subdirectory(types)
236227
add_subdirectory(func)

libc/hdr/offsetof_macros.h

-23
This file was deleted.

libc/include/llvm-libc-types/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ add_header(gid_t HDR gid_t.h)
3939
add_header(uid_t HDR uid_t.h)
4040
add_header(imaxdiv_t HDR imaxdiv_t.h)
4141
add_header(ino_t HDR ino_t.h)
42+
add_header(jmp_buf HDR jmp_buf.h)
4243
add_header(mbstate_t HDR mbstate_t.h)
4344
add_header(mode_t HDR mode_t.h)
4445
add_header(mtx_t HDR mtx_t.h DEPENDS .__futex_word .__mutex_type)
@@ -82,7 +83,6 @@ add_header(union_sigval HDR union_sigval.h)
8283
add_header(siginfo_t HDR siginfo_t.h DEPENDS .union_sigval .pid_t .uid_t .clock_t)
8384
add_header(sig_atomic_t HDR sig_atomic_t.h)
8485
add_header(sigset_t HDR sigset_t.h DEPENDS libc.include.llvm-libc-macros.signal_macros)
85-
add_header(jmp_buf HDR jmp_buf.h DEPENDS .sigset_t)
8686
add_header(struct_sigaction HDR struct_sigaction.h DEPENDS .sigset_t .siginfo_t)
8787
add_header(struct_timespec HDR struct_timespec.h DEPENDS .time_t)
8888
add_header(

libc/include/llvm-libc-types/jmp_buf.h

-15
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#ifndef LLVM_LIBC_TYPES_JMP_BUF_H
1010
#define LLVM_LIBC_TYPES_JMP_BUF_H
1111

12-
#include "sigset_t.h"
13-
1412
typedef struct {
1513
#ifdef __x86_64__
1614
__UINT64_TYPE__ rbx;
@@ -51,22 +49,9 @@ typedef struct {
5149
#endif
5250
#else
5351
#error "__jmp_buf not available for your target architecture."
54-
#endif
55-
// TODO: implement sigjmp_buf related functions for other architectures
56-
// Issue: https://github.com/llvm/llvm-project/issues/136358
57-
#if defined(__i386__) || defined(__x86_64__)
58-
// return address
59-
void *sig_retaddr;
60-
// extra register buffer to avoid indefinite stack growth in sigsetjmp
61-
void *sig_extra;
62-
// signal masks
63-
sigset_t sigmask;
6452
#endif
6553
} __jmp_buf;
6654

6755
typedef __jmp_buf jmp_buf[1];
6856

69-
#if defined(__i386__) || defined(__x86_64__)
70-
typedef __jmp_buf sigjmp_buf[1];
71-
#endif
7257
#endif // LLVM_LIBC_TYPES_JMP_BUF_H

libc/include/setjmp.yaml

-16
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,3 @@ functions:
2121
- _Returns_twice
2222
arguments:
2323
- type: jmp_buf
24-
- name: sigsetjmp
25-
standards:
26-
- POSIX
27-
return_type: int
28-
attributes:
29-
- _Returns_twice
30-
arguments:
31-
- type: sigjmp_buf
32-
- type: int
33-
- name: siglongjmp
34-
standards:
35-
- POSIX
36-
return_type: _Noreturn void
37-
arguments:
38-
- type: sigjmp_buf
39-
- type: int

libc/src/setjmp/CMakeLists.txt

-27
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
2-
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-
)
9-
endif()
10-
111
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
122
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
133
endif()
@@ -25,20 +15,3 @@ add_entrypoint_object(
2515
DEPENDS
2616
.${LIBC_TARGET_ARCHITECTURE}.longjmp
2717
)
28-
29-
add_entrypoint_object(
30-
siglongjmp
31-
SRCS
32-
siglongjmp.cpp
33-
HDRS
34-
siglongjmp.h
35-
DEPENDS
36-
.longjmp
37-
)
38-
39-
add_entrypoint_object(
40-
sigsetjmp
41-
ALIAS
42-
DEPENDS
43-
.${LIBC_TARGET_ARCHITECTURE}.sigsetjmp
44-
)

libc/src/setjmp/linux/CMakeLists.txt

-12
This file was deleted.

libc/src/setjmp/linux/sigsetjmp_epilogue.cpp

-25
This file was deleted.

libc/src/setjmp/setjmp_impl.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ namespace LIBC_NAMESPACE_DECL {
2929
#ifdef LIBC_COMPILER_IS_GCC
3030
[[gnu::nothrow]]
3131
#endif
32-
[[gnu::returns_twice]] int
33-
setjmp(jmp_buf buf);
32+
__attribute__((returns_twice)) int setjmp(jmp_buf buf);
3433

3534
} // namespace LIBC_NAMESPACE_DECL
3635

libc/src/setjmp/siglongjmp.cpp

-23
This file was deleted.

libc/src/setjmp/siglongjmp.h

-25
This file was deleted.

libc/src/setjmp/sigsetjmp.h

-26
This file was deleted.

libc/src/setjmp/sigsetjmp_epilogue.h

-19
This file was deleted.

libc/src/setjmp/x86_64/CMakeLists.txt

+5-15
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,9 @@ add_entrypoint_object(
55
HDRS
66
../setjmp_impl.h
77
DEPENDS
8-
libc.hdr.offsetof_macros
98
libc.hdr.types.jmp_buf
10-
)
11-
12-
add_entrypoint_object(
13-
sigsetjmp
14-
SRCS
15-
sigsetjmp.cpp
16-
HDRS
17-
../sigsetjmp.h
18-
DEPENDS
19-
libc.hdr.types.jmp_buf
20-
libc.hdr.types.sigset_t
21-
libc.hdr.offsetof_macros
22-
libc.src.setjmp.sigsetjmp_epilogue
23-
libc.src.setjmp.setjmp
9+
COMPILE_OPTIONS
10+
${libc_opt_high_flag}
2411
)
2512

2613
add_entrypoint_object(
@@ -31,4 +18,7 @@ add_entrypoint_object(
3118
../longjmp.h
3219
DEPENDS
3320
libc.hdr.types.jmp_buf
21+
COMPILE_OPTIONS
22+
${libc_opt_high_flag}
23+
-fomit-frame-pointer
3424
)

libc/src/setjmp/x86_64/setjmp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "hdr/offsetof_macros.h"
9+
#include "include/llvm-libc-macros/offsetof-macro.h"
1010
#include "src/__support/common.h"
1111
#include "src/__support/macros/config.h"
1212
#include "src/setjmp/setjmp_impl.h"

0 commit comments

Comments
 (0)