Skip to content

[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

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libc/src/__support/OSUtil/baremetal/exit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions libc/src/__support/OSUtil/baremetal/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

#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;
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);
Expand Down
4 changes: 2 additions & 2 deletions libc/src/stdlib/exit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions libc/startup/baremetal/fini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions libc/startup/baremetal/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
#include <stddef.h>
#include <stdint.h>

namespace LIBC_NAMESPACE {

extern "C" {
extern uintptr_t __preinit_array_start[];
extern uintptr_t __preinit_array_end[];
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) {
Expand Down
Loading