[libc-commits] [libc] [libc] Mark external baremetal I/O symbols as extern "C" (PR #98871)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Mon Jul 15 01:21:37 PDT 2024


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

These need to use C ABI.

>From a2e53d1ccfa7674b5dc1d6dc75eb7c188e908973 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Mon, 15 Jul 2024 01:13:26 -0700
Subject: [PATCH] [libc] Mark external baremetal I/O symbols as extern "C"

These need to use C ABI.
---
 libc/src/__support/OSUtil/baremetal/io.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/src/__support/OSUtil/baremetal/io.cpp b/libc/src/__support/OSUtil/baremetal/io.cpp
index f8ec603568936..2a9ef6bfa6579 100644
--- a/libc/src/__support/OSUtil/baremetal/io.cpp
+++ b/libc/src/__support/OSUtil/baremetal/io.cpp
@@ -44,9 +44,9 @@ namespace LIBC_NAMESPACE_DECL {
 
 struct __llvm_libc_stdio_cookie;
 
-extern struct __llvm_libc_stdio_cookie __llvm_libc_stdin_cookie;
-extern struct __llvm_libc_stdio_cookie __llvm_libc_stdout_cookie;
-extern struct __llvm_libc_stdio_cookie __llvm_libc_stderr_cookie;
+extern "C" struct __llvm_libc_stdio_cookie __llvm_libc_stdin_cookie;
+extern "C" struct __llvm_libc_stdio_cookie __llvm_libc_stdout_cookie;
+extern "C" struct __llvm_libc_stdio_cookie __llvm_libc_stderr_cookie;
 
 extern "C" ssize_t __llvm_libc_stdio_read(void *cookie, char *buf, size_t size);
 extern "C" ssize_t __llvm_libc_stdio_write(void *cookie, const char *buf,



More information about the libc-commits mailing list