1 //===-- Implementation of __errno_location --------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "src/errno/llvmlibc_errno.h"
11 #include "src/__support/common.h"
13 namespace __llvm_libc
{
15 static thread_local
int __errno
= 0;
17 // __errno_location is not really an entry point but we still want it to behave
18 // like an entry point because the errno macro resolves to the C symbol
19 // "__errno_location".
20 int *LLVM_LIBC_ENTRYPOINT(__errno_location
)() { return &__errno
; }
22 } // namespace __llvm_libc