[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
Tue Jun 10 21:37:44 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:
This was a comment about `LIBC_NAMESPACE` - my original thinking was that we should ask all users to define their own, project-specific value for it. But you bring up a good point that llvm-libc code sharing is headers-only - there are no object files linked in, so all the functions in headers are either static or inline, and thus they would have no exported symbols, so ODR violation indeed shouldn't be a problem. I agree that providing a sensible default here (and even removing it from the CMake module) is a reasonable path forward.
https://github.com/llvm/llvm-project/pull/143187
More information about the llvm-commits
mailing list