libc.src.ctype.tolower
libc.src.ctype.toupper
- # errno.h entrypoints
- libc.src.errno.__errno_location
-
# fcntl.h entrypoints
libc.src.fcntl.creat
libc.src.fcntl.open
def ErrnoMacro : MacroDef<"errno"> {
let Defn = [{
- #ifdef __cplusplus
- extern "C"
- #endif
- int *__errno_location();
- #define errno (*__errno_location())
+ extern _Thread_local int __llvmlibc_errno;
+ #define errno __llvmlibc_errno
}];
}
libc.src.ctype.tolower
libc.src.ctype.toupper
- # errno.h entrypoints
- libc.src.errno.__errno_location
-
# fcntl.h entrypoints
libc.src.fcntl.creat
libc.src.fcntl.open
#undef _Alignof
#define _Alignof alignof
+#undef _Thread_local
+#define _Thread_local thread_local
+
#else // not __cplusplus
#undef __BEGIN_C_DECLS
]
>;
- HeaderSpec Errno = HeaderSpec<
- "errno.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "__errno_location",
- RetValSpec<IntPtr>,
- [ArgSpec<VoidType>]
-
- >,
- ]
- >;
-
let Headers = [
String,
Assert,
- Errno,
];
}
DEPENDS
.ctype_utils
libc.include.errno
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.__support.CPP.standalone_cpp
)
.ctype_utils
.high_precision_decimal
libc.include.errno
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.__support.CPP.standalone_cpp
libc.src.__support.FPUtil.fputil
)
libc.include.fenv
libc.src.__support.common
libc.src.__support.CPP.standalone_cpp
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_header_library(
HDRS
file.h
DEPENDS
- libc.src.errno.__errno_location
+ libc.include.errno
+ libc.src.errno.errno
)
if (LLVM_LIBC_FULL_BUILD)
-add_entrypoint_object(
- __errno_location
+add_object_library(
+ errno
SRCS
- __errno_location.cpp
+ errno.cpp
HDRS
- __errno_location.h
llvmlibc_errno.h
)
else()
-add_entrypoint_object(
- __errno_location
+add_object_library(
+ errno
SRCS
dummy_errno.cpp
HDRS
+++ /dev/null
-//===-- Implementation of __errno_location --------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/errno/__errno_location.h"
-
-#include "src/__support/common.h"
-
-namespace __llvm_libc {
-
-static thread_local int errno = 0;
-
-// __errno_location is not really an entry point but we still want it to behave
-// like an entry point because the errno macro resolves to the C symbol
-// "__errno_location".
-LLVM_LIBC_FUNCTION(int *, __errno_location, ()) { return &errno; }
-
-} // namespace __llvm_libc
+++ /dev/null
-//===-- Implementation header for __errno_location --------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SRC_ERRNO_ERRNO_LOCATION_H
-#define LLVM_LIBC_SRC_ERRNO_ERRNO_LOCATION_H
-
-namespace __llvm_libc {
-
-int *__errno_location();
-
-} // namespace __llvm_libc
-
-#endif // LLVM_LIBC_SRC_ERRNO_ERRNO_LOCATION_H
--- /dev/null
+//===-- Implementation of __errno_location --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+thread_local int __llvmlibc_errno = 0;
//
//===----------------------------------------------------------------------===//
-#include "src/errno/__errno_location.h"
-
#ifndef LLVM_LIBC_SRC_ERRNO_LLVMLIBC_ERRNO_H
#define LLVM_LIBC_SRC_ERRNO_LLVMLIBC_ERRNO_H
// Internal code should use this and not use the errno macro from the
// public header.
-#define llvmlibc_errno (*__llvm_libc::__errno_location())
+extern thread_local int __llvmlibc_errno;
+#define llvmlibc_errno __llvmlibc_errno
#endif // LLVM_LIBC_SRC_ERRNO_LLVMLIBC_ERRNO_H
libc.include.errno
libc.include.fcntl
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.errno
libc.include.fcntl
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.errno
libc.include.fcntl
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_object_library(
DEPENDS
.sincosf_utils
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
COMPILE_OPTIONS
-O3
)
DEPENDS
.sincosf_utils
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.__support.FPUtil.fputil
COMPILE_OPTIONS
-O3
DEPENDS
.sincosf_utils
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
COMPILE_OPTIONS
-O3
)
libc.include.signal
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.signal
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
DEPENDS
libc.include.errno
libc.include.signal
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
DEPENDS
libc.include.errno
libc.include.signal
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
DEPENDS
libc.include.errno
libc.include.signal
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
DEPENDS
libc.include.errno
libc.include.signal
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
libc.include.sys_mman
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.sys_mman
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
libc.include.sys_stat
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.sys_stat
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
libc.include.threads
libc.src.__support.common
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.sys.mman.mmap
COMPILE_OPTIONS
-O3
DEPENDS
libc.include.errno
libc.include.time
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
.time_utils
libc.include.errno
libc.include.time
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
add_entrypoint_object(
libc.include.unistd
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
# libc.include.sys_mman
# libc.loader.linux.crt1
# libc.src.assert.__assert_fail
-# libc.src.errno.__errno_location
+# libc.src.errno.errno
# libc.src.sys.mman.mmap
#)
SRCS
file_test.cpp
DEPENDS
+ libc.include.errno
libc.include.stdio
libc.include.stdlib
libc.src.__support.File.file
SRCS
errno_test.cpp
DEPENDS
- libc.src.errno.__errno_location
+ libc.src.errno.errno
)
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.fenv.feclearexcept
libc.src.fenv.feraiseexcept
libc.src.fenv.fetestexcept
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.fenv.feclearexcept
libc.src.fenv.feraiseexcept
libc.src.fenv.fetestexcept
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.fenv.feclearexcept
libc.src.fenv.feraiseexcept
libc.src.fenv.fetestexcept
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.fenv.feclearexcept
libc.src.fenv.feraiseexcept
libc.src.fenv.fetestexcept
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.fenv.feclearexcept
libc.src.fenv.feraiseexcept
libc.src.fenv.fetestexcept
DEPENDS
libc.include.errno
libc.include.math
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.fenv.feclearexcept
libc.src.fenv.feraiseexcept
libc.src.fenv.fetestexcept
sigprocmask_test.cpp
DEPENDS
libc.include.errno
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.signal.raise
libc.src.signal.sigaddset
libc.src.signal.sigemptyset
DEPENDS
libc.include.errno
libc.include.signal
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.signal.raise
libc.src.signal.signal
libc.test.errno_setter_matcher
DEPENDS
libc.include.errno
libc.include.sys_mman
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.sys.mman.mmap
libc.src.sys.mman.munmap
libc.test.errno_setter_matcher
thrd_test.cpp
DEPENDS
libc.include.threads
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.threads.thrd_create
libc.src.threads.thrd_join
)
mtx_test.cpp
DEPENDS
libc.include.threads
- libc.src.errno.__errno_location
+ libc.src.errno.errno
libc.src.threads.mtx_destroy
libc.src.threads.mtx_init
libc.src.threads.mtx_lock