[libc] [llvm] [libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (PR #143187)
Alexey Samsonov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 15:17:24 PDT 2025
================
@@ -0,0 +1,20 @@
+//===-- Common defines for sharing LLVM libc with LLVM projects -*- 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_SHARED_LIBC_COMMON_H
+#define LLVM_LIBC_SHARED_LIBC_COMMON_H
+
+// Use system errno.
+#undef LIBC_ERRNO_MODE
+#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM
+
+#ifndef LIBC_NAMESPACE
----------------
vonosmas wrote:
I'm not quite sure I follow this - if there are non-CMake users of libc++ today, they already have to define `LIBC_NAMESPACE` to something, aren't they? The reason I bring this up, is - I worry that, let's say, you have `libc/shared` code included used in:
* LLVM APFloat - and you have default LIBC_NAMESPACE = __llvm_libc
* libcxx.so - which is built from an older version of repository, but also happen to use default LIBC_NAMESPACE = __llvm_libc
Then if you LLVM is linked against libcxx, you may end up with ODR violations of having two different versions of __llvm_libc::<some_function>.
https://github.com/llvm/llvm-project/pull/143187
More information about the llvm-commits
mailing list