-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Move the internal extern "C" symbols inside the namespace #98232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This ensures that these symbols inherit the namespace visibility.
@llvm/pr-subscribers-libc Author: Petr Hosek (petrhosek) ChangesThis ensures that these symbols inherit the namespace visibility. Full diff: https://github.com/llvm/llvm-project/pull/98232.diff 5 Files Affected:
diff --git a/libc/src/__support/OSUtil/baremetal/exit.cpp b/libc/src/__support/OSUtil/baremetal/exit.cpp
index 08473f7f3b00b..26088c28b0a50 100644
--- a/libc/src/__support/OSUtil/baremetal/exit.cpp
+++ b/libc/src/__support/OSUtil/baremetal/exit.cpp
@@ -8,11 +8,11 @@
#include "src/__support/OSUtil/exit.h"
+namespace LIBC_NAMESPACE::internal {
+
// This is intended to be provided by the vendor.
extern "C" [[noreturn]] void __llvm_libc_exit(int status);
-namespace LIBC_NAMESPACE::internal {
-
[[noreturn]] void exit(int status) { __llvm_libc_exit(status); }
} // namespace LIBC_NAMESPACE::internal
diff --git a/libc/src/__support/OSUtil/baremetal/io.cpp b/libc/src/__support/OSUtil/baremetal/io.cpp
index 5dd92e4a56ce4..c97bd5ae65b13 100644
--- a/libc/src/__support/OSUtil/baremetal/io.cpp
+++ b/libc/src/__support/OSUtil/baremetal/io.cpp
@@ -10,6 +10,8 @@
#include "src/__support/CPP/string_view.h"
+namespace LIBC_NAMESPACE {
+
// This is intended to be provided by the vendor.
extern struct __llvm_libc_stdin __llvm_libc_stdin;
@@ -17,8 +19,6 @@ 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(reinterpret_cast<void *>(&__llvm_libc_stdin),
buf, size);
diff --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp
index 1f7ccbb556607..1afeec5a460da 100644
--- a/libc/src/stdlib/exit.cpp
+++ b/libc/src/stdlib/exit.cpp
@@ -10,10 +10,10 @@
#include "src/__support/OSUtil/exit.h"
#include "src/__support/common.h"
-extern "C" void __cxa_finalize(void *);
-
namespace LIBC_NAMESPACE {
+extern "C" void __cxa_finalize(void *);
+
[[noreturn]] LLVM_LIBC_FUNCTION(void, exit, (int status)) {
__cxa_finalize(nullptr);
internal::exit(status);
diff --git a/libc/startup/baremetal/fini.cpp b/libc/startup/baremetal/fini.cpp
index 84997fb4fa1d8..745bd094b24fe 100644
--- a/libc/startup/baremetal/fini.cpp
+++ b/libc/startup/baremetal/fini.cpp
@@ -9,13 +9,13 @@
#include <stddef.h>
#include <stdint.h>
+namespace LIBC_NAMESPACE {
+
extern "C" {
extern uintptr_t __fini_array_start[];
extern uintptr_t __fini_array_end[];
}
-namespace LIBC_NAMESPACE {
-
using FiniCallback = void(void);
extern "C" void __libc_fini_array(void) {
diff --git a/libc/startup/baremetal/init.cpp b/libc/startup/baremetal/init.cpp
index 08dff74f05198..21ec0e5ca756d 100644
--- a/libc/startup/baremetal/init.cpp
+++ b/libc/startup/baremetal/init.cpp
@@ -9,6 +9,8 @@
#include <stddef.h>
#include <stdint.h>
+namespace LIBC_NAMESPACE {
+
extern "C" {
extern uintptr_t __preinit_array_start[];
extern uintptr_t __preinit_array_end[];
@@ -16,8 +18,6 @@ extern uintptr_t __init_array_start[];
extern uintptr_t __init_array_end[];
}
-namespace LIBC_NAMESPACE {
-
using InitCallback = void(void);
extern "C" void __libc_init_array(void) {
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/93/builds/1707 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/78/builds/1606 Here is the relevant piece of the build log for the reference:
|
…m#98232) This ensures that these symbols inherit the namespace visibility.
This ensures that these symbols inherit the namespace visibility.