[libc-commits] [libc] 381f9af - [libc][NFC] Add dummy errno target to satisfy mixed mode builds.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Fri Jul 30 10:45:09 PDT 2021


Author: Siva Chandra Reddy
Date: 2021-07-30T17:42:48Z
New Revision: 381f9affabba647a44412803562b19519fc25611

URL: https://github.com/llvm/llvm-project/commit/381f9affabba647a44412803562b19519fc25611
DIFF: https://github.com/llvm/llvm-project/commit/381f9affabba647a44412803562b19519fc25611.diff

LOG: [libc][NFC] Add dummy errno target to satisfy mixed mode builds.

In mixed mode builds, we should not be including errno as part of
LLVM libc - errno from another library (or the system library) should be
used. But, other entrypoints which use errno list LLVM libc's errno as a
dep ta satisfy the full build mode. So, we add a dummy errno
implementation with empty files to make both mixed mode and full build
mode happy.

Added: 
    libc/src/errno/dummy_errno.cpp
    libc/src/errno/dummy_errno.h

Modified: 
    libc/src/errno/CMakeLists.txt
    libc/test/src/errno/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/src/errno/CMakeLists.txt b/libc/src/errno/CMakeLists.txt
index e13aa1df9b174..eff1c73fa0c9d 100644
--- a/libc/src/errno/CMakeLists.txt
+++ b/libc/src/errno/CMakeLists.txt
@@ -1,3 +1,4 @@
+if (LLVM_LIBC_FULL_BUILD)
 add_entrypoint_object(
   __errno_location
   SRCS
@@ -6,3 +7,12 @@ add_entrypoint_object(
     __errno_location.h
     llvmlibc_errno.h
 )
+else()
+add_entrypoint_object(
+  __errno_location
+  SRCS
+    dummy_errno.cpp
+  HDRS
+    dummy_errno.h
+)
+endif()

diff  --git a/libc/src/errno/dummy_errno.cpp b/libc/src/errno/dummy_errno.cpp
new file mode 100644
index 0000000000000..6abf0ea5dbd51
--- /dev/null
+++ b/libc/src/errno/dummy_errno.cpp
@@ -0,0 +1,7 @@
+//===-- An empty file to be used for mixed mode builds --------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//

diff  --git a/libc/src/errno/dummy_errno.h b/libc/src/errno/dummy_errno.h
new file mode 100644
index 0000000000000..2d007b201b440
--- /dev/null
+++ b/libc/src/errno/dummy_errno.h
@@ -0,0 +1,7 @@
+//===-- An empty file to be used for mixed mode builds ----------*- 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
+//
+//===----------------------------------------------------------------------===//

diff  --git a/libc/test/src/errno/CMakeLists.txt b/libc/test/src/errno/CMakeLists.txt
index 61a3094ea021f..d60ee207d8840 100644
--- a/libc/test/src/errno/CMakeLists.txt
+++ b/libc/test/src/errno/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(NOT LLVM_LIBC_FULL_BUILD)
+  return()
+endif()
+
 add_libc_testsuite(libc_errno_unittests)
 
 add_libc_unittest(


        


More information about the libc-commits mailing list