[libc-commits] [libc] [libc] Initial support for 'locale.h' in the LLVM libc (PR #102689)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Sat Aug 10 22:27:57 PDT 2024


================
@@ -0,0 +1,21 @@
+//===-- Implementation of locale ------------------------------------------===//
+//
+// 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/locale/locale.h"
+
+#include "include/llvm-libc-macros/locale-macros.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+__locale_t c_locale = {nullptr};
+
+LIBC_THREAD_LOCAL locale_t locale = &c_locale;
----------------
petrhosek wrote:

Taking an address of the global variable is going to require a runtime relocation which is a problem for environments like baremetal.

https://github.com/llvm/llvm-project/pull/102689


More information about the libc-commits mailing list