Skip to content

Commit be9b1de

Browse files
authored
[libc] Move the internal extern "C" symbols inside the namespace (#98232)
This ensures that these symbols inherit the namespace visibility.
1 parent 04f0adc commit be9b1de

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

libc/src/__support/OSUtil/baremetal/exit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
#include "src/__support/OSUtil/exit.h"
1010

11+
namespace LIBC_NAMESPACE::internal {
12+
1113
// This is intended to be provided by the vendor.
1214
extern "C" [[noreturn]] void __llvm_libc_exit(int status);
1315

14-
namespace LIBC_NAMESPACE::internal {
15-
1616
[[noreturn]] void exit(int status) { __llvm_libc_exit(status); }
1717

1818
} // namespace LIBC_NAMESPACE::internal

libc/src/__support/OSUtil/baremetal/io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
#include "src/__support/CPP/string_view.h"
1212

13+
namespace LIBC_NAMESPACE {
14+
1315
// This is intended to be provided by the vendor.
1416

1517
extern struct __llvm_libc_stdin __llvm_libc_stdin;
1618
extern "C" ssize_t __llvm_libc_stdin_read(void *cookie, char *buf, size_t size);
1719

1820
extern "C" void __llvm_libc_log_write(const char *msg, size_t len);
1921

20-
namespace LIBC_NAMESPACE {
21-
2222
ssize_t read_from_stdin(char *buf, size_t size) {
2323
return __llvm_libc_stdin_read(reinterpret_cast<void *>(&__llvm_libc_stdin),
2424
buf, size);

libc/src/stdlib/exit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include "src/__support/OSUtil/exit.h"
1111
#include "src/__support/common.h"
1212

13-
extern "C" void __cxa_finalize(void *);
14-
1513
namespace LIBC_NAMESPACE {
1614

15+
extern "C" void __cxa_finalize(void *);
16+
1717
[[noreturn]] LLVM_LIBC_FUNCTION(void, exit, (int status)) {
1818
__cxa_finalize(nullptr);
1919
internal::exit(status);

libc/startup/baremetal/fini.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#include <stddef.h>
1010
#include <stdint.h>
1111

12+
namespace LIBC_NAMESPACE {
13+
1214
extern "C" {
1315
extern uintptr_t __fini_array_start[];
1416
extern uintptr_t __fini_array_end[];
1517
}
1618

17-
namespace LIBC_NAMESPACE {
18-
1919
using FiniCallback = void(void);
2020

2121
extern "C" void __libc_fini_array(void) {

libc/startup/baremetal/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
#include <stddef.h>
1010
#include <stdint.h>
1111

12+
namespace LIBC_NAMESPACE {
13+
1214
extern "C" {
1315
extern uintptr_t __preinit_array_start[];
1416
extern uintptr_t __preinit_array_end[];
1517
extern uintptr_t __init_array_start[];
1618
extern uintptr_t __init_array_end[];
1719
}
1820

19-
namespace LIBC_NAMESPACE {
20-
2121
using InitCallback = void(void);
2222

2323
extern "C" void __libc_init_array(void) {

0 commit comments

Comments
 (0)