File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 25
25
#include "llvm-libc-macros/generic-error-number-macros.h"
26
26
#endif
27
27
28
- #if defined(__AMDGPU__) || defined(__NVPTX__)
28
+ #if defined(__AMDGPU__) || defined(__NVPTX__) || \
29
+ (defined(__ELF__) && !defined(__linux__) && !defined(__Fuchsia__))
29
30
extern int __llvmlibc_errno; // Not thread_local!
30
31
#else
31
32
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ LIBC_NAMESPACE::Errno::operator int() {
23
23
return __llvmlibc_errno.load (cpp::MemoryOrder::RELAXED);
24
24
}
25
25
26
+ #elif defined(__ELF__) && !defined(__linux__) && !defined(__Fuchsia__)
27
+ // This is the baremetal case which currently uses a global errno.
28
+ extern " C" {
29
+ int __llvmlibc_errno;
30
+ }
31
+
32
+ void LIBC_NAMESPACE::Errno::operator =(int a) { __llvmlibc_errno = a; }
33
+ LIBC_NAMESPACE::Errno::operator int () { return __llvmlibc_errno; }
34
+
26
35
#elif !defined(LIBC_COPT_PUBLIC_PACKAGING)
27
36
// This mode is for unit testing. We just use our internal errno.
28
37
LIBC_THREAD_LOCAL int __llvmlibc_internal_errno;
You can’t perform that action at this time.
0 commit comments