Skip to content

Commit 70ae480

Browse files
committed
[libc][NFC] Remove all Linux specific code to respective linux/ directories
These were all the non OS agnostic implementations I could find in general directories. Currently none of these functions are actually enabled, but for when they do it makes sense that they be in linux/ specific directories. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D119164
1 parent c8ba2b6 commit 70ae480

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

libc/src/assert/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ add_entrypoint_object(
66
__assert_fail.h
77
assert.h
88
DEPENDS
9-
# These two dependencies are temporary and should be replaced by fprintf
10-
# later.
119
libc.src.__support.OSUtil.osutil
12-
libc.include.sys_syscall
1310
libc.src.stdlib.abort
1411
)

libc/src/assert/__assert_fail.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,12 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "src/__support/OSUtil/io.h"
910
#include "src/assert/__assert_fail.h"
1011
#include "src/stdlib/abort.h"
1112

12-
// These includes are temporary.
13-
#include "include/sys/syscall.h" // For syscall numbers.
14-
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
15-
1613
namespace __llvm_libc {
1714

18-
// This is just a temporary solution to make assert available to internal
19-
// llvm libc code. In the future writeToStderr will not exist and __assert_fail
20-
// will call fprintf(stderr, ...).
21-
static void write_to_stderr(const char *s) {
22-
size_t length = 0;
23-
for (const char *curr = s; *curr; ++curr, ++length);
24-
__llvm_libc::syscall(SYS_write, 2, s, length);
25-
}
26-
2715
LLVM_LIBC_FUNCTION(void, __assert_fail,
2816
(const char *assertion, const char *file, unsigned line,
2917
const char *function)) {

libc/src/stdlib/CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,7 @@ add_entrypoint_object(
250250

251251
# add_entrypoint_object(
252252
# abort
253-
# SRCS
254-
# abort.cpp
255-
# HDRS
256-
# abort.h
253+
# ALIAS
257254
# DEPENDS
258-
# libc.include.stdlib
259-
# libc.src.signal.raise
260-
# ._Exit
255+
# .${LIBC_TARGET_OS}.abort
261256
# )

libc/src/stdlib/linux/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@ add_entrypoint_object(
99
libc.include.stdlib
1010
libc.src.__support.OSUtil.osutil
1111
)
12+
13+
# add_entrypoint_object(
14+
# abort
15+
# SRCS
16+
# abort.cpp
17+
# HDRS
18+
# ../abort.h
19+
# DEPENDS
20+
# libc.include.stdlib
21+
# libc.src.signal.raise
22+
# ._Exit
23+
# )
File renamed without changes.

0 commit comments

Comments
 (0)