[libc-commits] [libc] [libc] Include empty remove in baremetal stdio.h (PR #85336)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Thu Mar 14 16:35:14 PDT 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/85336

This is required to avoid compilation error in libc++.

See #85335 for more details.

>From b9482dead43823dc44dba5f7cefe1c2c96144de4 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Wed, 13 Mar 2024 00:30:34 -0700
Subject: [PATCH] [libc] Include empty remove in baremetal stdio.h

This is required to avoid compilation error in libc++.

See #85335 for more details.
---
 libc/config/baremetal/arm/entrypoints.txt   |  1 +
 libc/config/baremetal/riscv/entrypoints.txt |  1 +
 libc/src/stdio/baremetal/CMakeLists.txt     |  7 +++++++
 libc/src/stdio/baremetal/remove.cpp         | 22 +++++++++++++++++++++
 4 files changed, 31 insertions(+)
 create mode 100644 libc/src/stdio/baremetal/CMakeLists.txt
 create mode 100644 libc/src/stdio/baremetal/remove.cpp

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 589ec5237e98da..d97c8d75fe309a 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -79,6 +79,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.inttypes.strtoumax
 
     # stdio.h entrypoints
+    libc.src.stdio.remove
     libc.src.stdio.sprintf
     libc.src.stdio.snprintf
     libc.src.stdio.vsprintf
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 09de1b416e0e94..19c9ac7fbe8515 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -79,6 +79,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.inttypes.strtoumax
 
     # stdio.h entrypoints
+    libc.src.stdio.remove
     libc.src.stdio.sprintf
     libc.src.stdio.snprintf
     libc.src.stdio.vsprintf
diff --git a/libc/src/stdio/baremetal/CMakeLists.txt b/libc/src/stdio/baremetal/CMakeLists.txt
new file mode 100644
index 00000000000000..734a66f72ecf6f
--- /dev/null
+++ b/libc/src/stdio/baremetal/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_entrypoint_object(
+  remove
+  SRCS
+    remove.cpp
+  HDRS
+    ../remove.h
+)
diff --git a/libc/src/stdio/baremetal/remove.cpp b/libc/src/stdio/baremetal/remove.cpp
new file mode 100644
index 00000000000000..c1c834d13952bf
--- /dev/null
+++ b/libc/src/stdio/baremetal/remove.cpp
@@ -0,0 +1,22 @@
+//===-- Linux implementation of remove ------------------------------------===//
+//
+// 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/stdio/remove.h"
+
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+// TODO: See https://github.com/llvm/llvm-project/issues/85335 for more details
+// on why this is needed.
+
+LLVM_LIBC_FUNCTION(int, remove, (const char *)) {
+  return -1;
+}
+
+} // namespace LIBC_NAMESPACE



More information about the libc-commits mailing list