[libc-commits] [libc] [libc] Provide baremetal implementation of getchar (PR #98059)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Tue Jul 9 01:38:57 PDT 2024
================
@@ -11,10 +11,19 @@
#include "src/__support/CPP/string_view.h"
// This is intended to be provided by the vendor.
+
+extern struct __llvm_libc_stdin __llvm_libc_stdin;
+extern "C" ssize_t __llvm_libc_stdin_read(void *cookie, char *buf, size_t size);
+
extern "C" void __llvm_libc_log_write(const char *msg, size_t len);
namespace LIBC_NAMESPACE {
+ssize_t read_from_stdin(char *buf, size_t size) {
+ return __llvm_libc_stdin_read(static_cast<void *>(&__llvm_libc_stdin), buf,
----------------
petrhosek wrote:
Done
https://github.com/llvm/llvm-project/pull/98059
More information about the libc-commits
mailing list