File tree 15 files changed +32
-115
lines changed
utils/bazel/llvm-project-overlay/libc
15 files changed +32
-115
lines changed Original file line number Diff line number Diff line change @@ -8,23 +8,10 @@ if(NOT TARGET ${target_os_util})
8
8
return ()
9
9
endif ()
10
10
11
- # The OSUtil is an object library in GPU mode.
12
- if (NOT LIBC_TARGET_OS_IS_GPU)
13
- add_header_library(
14
- osutil
15
- HDRS
16
- io.h
17
- quick_exit.h
18
- syscall.h
19
- DEPENDS
20
- ${target_os_util}
21
- )
22
- else ()
23
- add_object_library(
24
- osutil
25
- ALIAS
26
- ${target_os_util}
27
- DEPENDS
28
- ${target_os_util}
29
- )
30
- endif ()
11
+ add_object_library(
12
+ osutil
13
+ ALIAS
14
+ ${target_os_util}
15
+ DEPENDS
16
+ ${target_os_util}
17
+ )
Original file line number Diff line number Diff line change 1
- add_header_library (
1
+ add_object_library (
2
2
baremetal_util
3
+ SRCS
4
+ quick_exit.cpp
3
5
HDRS
4
6
io.h
5
- quick_exit.h
6
7
DEPENDS
7
8
libc.src.__support.common
8
9
libc.src.__support.CPP.string_view
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
- #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_BAREMETAL_QUICK_EXIT_H
10
- #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_BAREMETAL_QUICK_EXIT_H
11
-
12
- namespace LIBC_NAMESPACE {
9
+ #include " src/__support/OSUtil/quick_exit.h"
13
10
14
11
// This is intended to be provided by the vendor.
15
- extern " C" void __llvm_libc_quick_exit (int status);
12
+ [[noreturn]] extern " C" void __llvm_libc_quick_exit (int status);
16
13
17
- void quick_exit ( int status) { __llvm_libc_quick_exit (status); }
14
+ namespace LIBC_NAMESPACE {
18
15
19
- } // namespace LIBC_NAMESPACE
16
+ [[noreturn]] void quick_exit ( int status) { __llvm_libc_quick_exit (status); }
20
17
21
- # endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_BAREMETAL_QUICK_EXIT_H
18
+ } // namespace LIBC_NAMESPACE
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ add_header_library(
8
8
darwin_util
9
9
HDRS
10
10
io.h
11
- quick_exit.h
12
11
syscall.h
13
12
DEPENDS
14
13
.${LIBC_TARGET_ARCHITECTURE} .darwin_util
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ add_object_library(
4
4
quick_exit.cpp
5
5
io.cpp
6
6
HDRS
7
- quick_exit.h
8
7
io.h
9
8
DEPENDS
10
9
libc.src.__support.common
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
- #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
10
- #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
11
-
12
- #include " quick_exit.h"
9
+ #include " src/__support/OSUtil/quick_exit.h"
13
10
14
11
#include " src/__support/RPC/rpc_client.h"
15
12
#include " src/__support/macros/properties/architectures.h"
16
13
17
14
namespace LIBC_NAMESPACE {
18
15
19
- void quick_exit (int status) {
16
+ [[noreturn]] void quick_exit (int status) {
20
17
// We want to first make sure the server is listening before we exit.
21
18
rpc::Client::Port port = rpc::client.open <RPC_EXIT>();
22
19
port.send_and_recv ([](rpc::Buffer *) {}, [](rpc::Buffer *) {});
@@ -29,5 +26,3 @@ void quick_exit(int status) {
29
26
}
30
27
31
28
} // namespace LIBC_NAMESPACE
32
-
33
- #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_GPU_QUICK_EXIT_H
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ endif()
4
4
5
5
add_subdirectory (${LIBC_TARGET_ARCHITECTURE} )
6
6
7
- add_header_library (
7
+ add_object_library (
8
8
linux_util
9
+ SRCS
10
+ quick_exit.cpp
9
11
HDRS
10
12
io.h
11
- quick_exit.h
12
13
syscall.h
13
14
DEPENDS
14
15
.${LIBC_TARGET_ARCHITECTURE} .linux_${LIBC_TARGET_ARCHITECTURE} _util
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
- #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
10
- #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
11
-
12
- #include " syscall.h" // For internal syscall function.
13
-
14
9
#include " src/__support/common.h"
15
-
10
+ # include " syscall.h " // For internal syscall function.
16
11
#include < sys/syscall.h> // For syscall numbers.
17
12
18
13
namespace LIBC_NAMESPACE {
@@ -22,7 +17,7 @@ namespace LIBC_NAMESPACE {
22
17
#ifdef LIBC_TARGET_ARCH_IS_X86
23
18
__attribute__ ((no_stack_protector))
24
19
#endif
25
- LIBC_INLINE void
20
+ __attribute__ ((noreturn)) void
26
21
quick_exit (int status) {
27
22
for (;;) {
28
23
LIBC_NAMESPACE::syscall_impl<long >(SYS_exit_group, status);
@@ -31,5 +26,3 @@ quick_exit(int status) {
31
26
}
32
27
33
28
} // namespace LIBC_NAMESPACE
34
-
35
- #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
Original file line number Diff line number Diff line change 9
9
#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_QUICK_EXIT_H
10
10
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_QUICK_EXIT_H
11
11
12
- # include " src/__support/macros/properties/architectures.h "
12
+ namespace LIBC_NAMESPACE {
13
13
14
- #if defined(LIBC_TARGET_ARCH_IS_GPU)
15
- #include " gpu/quick_exit.h"
16
- #elif defined(__APPLE__)
17
- #include " darwin/quick_exit.h"
18
- #elif defined(__linux__)
19
- #include " linux/quick_exit.h"
20
- #elif defined(__ELF__)
21
- // TODO: Ideally we would have LIBC_TARGET_OS_IS_BAREMETAL.
22
- #include " baremetal/quick_exit.h"
23
- #endif
14
+ [[noreturn]] void quick_exit (int status);
15
+
16
+ }
24
17
25
18
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_QUICK_EXIT_H
Original file line number Diff line number Diff line change @@ -414,10 +414,11 @@ add_entrypoint_object(
414
414
CXX_STANDARD
415
415
20 # For constinit of the atexit callback list.
416
416
DEPENDS
417
- libc.src.__support.fixedvector
417
+ libc.src.__support.CPP.new
418
+ libc.src.__support.OSUtil.osutil
418
419
libc.src.__support.blockstore
420
+ libc.src.__support.fixedvector
419
421
libc.src.__support.threads.mutex
420
- libc.src.__support.CPP.new
421
422
)
422
423
423
424
add_entrypoint_object(
Original file line number Diff line number Diff line change 13
13
14
14
namespace LIBC_NAMESPACE {
15
15
16
- LLVM_LIBC_FUNCTION (void , _Exit, (int status)) {
16
+ [[noreturn]] LLVM_LIBC_FUNCTION(void , _Exit, (int status)) {
17
17
quick_exit (status);
18
- __builtin_unreachable ();
19
18
}
20
19
21
20
} // namespace LIBC_NAMESPACE
Original file line number Diff line number Diff line change @@ -14,10 +14,9 @@ extern "C" void __cxa_finalize(void *);
14
14
15
15
namespace LIBC_NAMESPACE {
16
16
17
- LLVM_LIBC_FUNCTION (void , exit, (int status)) {
17
+ [[noreturn]] LLVM_LIBC_FUNCTION(void , exit, (int status)) {
18
18
__cxa_finalize (nullptr );
19
19
quick_exit (status);
20
- __builtin_unreachable ();
21
20
}
22
21
23
22
} // namespace LIBC_NAMESPACE
Original file line number Diff line number Diff line change @@ -1002,10 +1002,7 @@ libc_support_library(
1002
1002
libc_support_library (
1003
1003
name = "__support_osutil_quick_exit" ,
1004
1004
hdrs = ["src/__support/OSUtil/quick_exit.h" ],
1005
- textual_hdrs = [
1006
- "src/__support/OSUtil/linux/quick_exit.h" ,
1007
- #TODO: add support for GPU quick_exit (isn't just in a header.)
1008
- ],
1005
+ srcs = ["src/__support/OSUtil/linux/quick_exit.cpp" ],
1009
1006
deps = [
1010
1007
":__support_osutil_syscall" ,
1011
1008
],
You can’t perform that action at this time.
0 commit comments