aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorAlex Brachet <abrachet@google.com>2023-04-07 19:25:27 +0000
committerAlex Brachet <abrachet@google.com>2023-04-07 19:25:27 +0000
commitd159c37235b1ca191cfa1cf43039710307abea6f (patch)
tree7b49a7e2a7ab8391d07cc971c7db60bacc28df0b /libc
parent730c8e160c9dead94ba534d5ad7cc8e47ce892db (diff)
downloadllvm-d159c37235b1ca191cfa1cf43039710307abea6f.zip
llvm-d159c37235b1ca191cfa1cf43039710307abea6f.tar.gz
llvm-d159c37235b1ca191cfa1cf43039710307abea6f.tar.bz2
[libc] Add baremetal abort
Differential Revision: https://reviews.llvm.org/D147795
Diffstat (limited to 'libc')
-rw-r--r--libc/src/stdlib/baremetal/CMakeLists.txt7
-rw-r--r--libc/src/stdlib/baremetal/abort.cpp17
2 files changed, 24 insertions, 0 deletions
diff --git a/libc/src/stdlib/baremetal/CMakeLists.txt b/libc/src/stdlib/baremetal/CMakeLists.txt
new file mode 100644
index 0000000..551a83a
--- /dev/null
+++ b/libc/src/stdlib/baremetal/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_entrypoint_object(
+ abort
+ SRCS
+ abort.cpp
+ HDRS
+ ../abort.h
+)
diff --git a/libc/src/stdlib/baremetal/abort.cpp b/libc/src/stdlib/baremetal/abort.cpp
new file mode 100644
index 0000000..f3164ce
--- /dev/null
+++ b/libc/src/stdlib/baremetal/abort.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of abort -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/common.h"
+
+#include "src/stdlib/abort.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(void, abort, ()) { __builtin_trap(); }
+
+} // namespace __llvm_libc