[libc-commits] [libc] d159c37 - [libc] Add baremetal abort

Alex Brachet via libc-commits libc-commits at lists.llvm.org
Fri Apr 7 12:26:44 PDT 2023


Author: Alex Brachet
Date: 2023-04-07T19:25:27Z
New Revision: d159c37235b1ca191cfa1cf43039710307abea6f

URL: https://github.com/llvm/llvm-project/commit/d159c37235b1ca191cfa1cf43039710307abea6f
DIFF: https://github.com/llvm/llvm-project/commit/d159c37235b1ca191cfa1cf43039710307abea6f.diff

LOG: [libc] Add baremetal abort

Differential Revision: https://reviews.llvm.org/D147795

Added: 
    libc/src/stdlib/baremetal/CMakeLists.txt
    libc/src/stdlib/baremetal/abort.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/libc/src/stdlib/baremetal/CMakeLists.txt b/libc/src/stdlib/baremetal/CMakeLists.txt
new file mode 100644
index 0000000000000..551a83a36b20e
--- /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 0000000000000..f3164ce5f09fc
--- /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


        


More information about the libc-commits mailing list