[libc-commits] [libc] 70ae480 - [libc][NFC] Remove all Linux specific code to respective linux/ directories
Alex Brachet via libc-commits
libc-commits at lists.llvm.org
Tue Feb 8 10:32:43 PST 2022
Author: Alex Brachet
Date: 2022-02-08T18:32:18Z
New Revision: 70ae480c82188b24327eeeb023f52aa15b1d62ce
URL: https://github.com/llvm/llvm-project/commit/70ae480c82188b24327eeeb023f52aa15b1d62ce
DIFF: https://github.com/llvm/llvm-project/commit/70ae480c82188b24327eeeb023f52aa15b1d62ce.diff
LOG: [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
Added:
libc/src/stdlib/linux/abort.cpp
Modified:
libc/src/assert/CMakeLists.txt
libc/src/assert/__assert_fail.cpp
libc/src/stdlib/CMakeLists.txt
libc/src/stdlib/linux/CMakeLists.txt
Removed:
libc/src/stdlib/abort.cpp
################################################################################
diff --git a/libc/src/assert/CMakeLists.txt b/libc/src/assert/CMakeLists.txt
index 7f82017e51c54..d3cf73e1df209 100644
--- a/libc/src/assert/CMakeLists.txt
+++ b/libc/src/assert/CMakeLists.txt
@@ -6,9 +6,6 @@ add_entrypoint_object(
__assert_fail.h
assert.h
DEPENDS
- # These two dependencies are temporary and should be replaced by fprintf
- # later.
libc.src.__support.OSUtil.osutil
- libc.include.sys_syscall
libc.src.stdlib.abort
)
diff --git a/libc/src/assert/__assert_fail.cpp b/libc/src/assert/__assert_fail.cpp
index 93c176a622316..7ee319e8beb19 100644
--- a/libc/src/assert/__assert_fail.cpp
+++ b/libc/src/assert/__assert_fail.cpp
@@ -6,24 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "src/__support/OSUtil/io.h"
#include "src/assert/__assert_fail.h"
#include "src/stdlib/abort.h"
-// These includes are temporary.
-#include "include/sys/syscall.h" // For syscall numbers.
-#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
-
namespace __llvm_libc {
-// This is just a temporary solution to make assert available to internal
-// llvm libc code. In the future writeToStderr will not exist and __assert_fail
-// will call fprintf(stderr, ...).
-static void write_to_stderr(const char *s) {
- size_t length = 0;
- for (const char *curr = s; *curr; ++curr, ++length);
- __llvm_libc::syscall(SYS_write, 2, s, length);
-}
-
LLVM_LIBC_FUNCTION(void, __assert_fail,
(const char *assertion, const char *file, unsigned line,
const char *function)) {
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 773a6d0e995da..b333def651e64 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -250,12 +250,7 @@ add_entrypoint_object(
# add_entrypoint_object(
# abort
-# SRCS
-# abort.cpp
-# HDRS
-# abort.h
+# ALIAS
# DEPENDS
-# libc.include.stdlib
-# libc.src.signal.raise
-# ._Exit
+# .${LIBC_TARGET_OS}.abort
# )
diff --git a/libc/src/stdlib/linux/CMakeLists.txt b/libc/src/stdlib/linux/CMakeLists.txt
index c5130c11ed915..637191871e011 100644
--- a/libc/src/stdlib/linux/CMakeLists.txt
+++ b/libc/src/stdlib/linux/CMakeLists.txt
@@ -9,3 +9,15 @@ add_entrypoint_object(
libc.include.stdlib
libc.src.__support.OSUtil.osutil
)
+
+# add_entrypoint_object(
+# abort
+# SRCS
+# abort.cpp
+# HDRS
+# ../abort.h
+# DEPENDS
+# libc.include.stdlib
+# libc.src.signal.raise
+# ._Exit
+# )
diff --git a/libc/src/stdlib/abort.cpp b/libc/src/stdlib/linux/abort.cpp
similarity index 100%
rename from libc/src/stdlib/abort.cpp
rename to libc/src/stdlib/linux/abort.cpp
More information about the libc-commits
mailing list