summaryrefslogtreecommitdiffstats
path: root/libc/src/errno/errno_location.cpp
blob: 1a1b2889c84b406034f45f0f9c5b9c0fa6aa2d80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//===----------------- 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/llvmlibc_errno.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".
int *LLVM_LIBC_ENTRYPOINT(__errno_location)() { return &__errno; }

} // namespace __llvm_libc
OpenPOWER on IntegriCloud