[libc-commits] [libc] 95ca2e2 - [libc] Fix swab placement

Caslyn Tonelli via libc-commits libc-commits at lists.llvm.org
Tue Apr 11 11:09:00 PDT 2023


Author: Caslyn Tonelli
Date: 2023-04-11T18:06:13Z
New Revision: 95ca2e2cf9d6d1e15df851269026eba78e064292

URL: https://github.com/llvm/llvm-project/commit/95ca2e2cf9d6d1e15df851269026eba78e064292
DIFF: https://github.com/llvm/llvm-project/commit/95ca2e2cf9d6d1e15df851269026eba78e064292.diff

LOG: [libc] Fix swab placement

Per https://reviews.llvm.org/D147970#4256889, swab.cpp is moved out of
the /linux subdirectory and cmake specifications are amended to reflect
that swab is not OS-specific.

Differential Revision: https://reviews.llvm.org/D147988

Added: 
    libc/src/unistd/swab.cpp

Modified: 
    libc/config/linux/aarch64/entrypoints.txt
    libc/config/linux/riscv64/entrypoints.txt
    libc/config/linux/x86_64/entrypoints.txt
    libc/src/unistd/CMakeLists.txt
    libc/src/unistd/linux/CMakeLists.txt

Removed: 
    libc/src/unistd/linux/swab.cpp


################################################################################
diff  --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 7d76e83d27a36..ef9a44ffe810c 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -189,7 +189,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.readlink
     libc.src.unistd.readlinkat
     libc.src.unistd.rmdir
-    libc.src.unistd.swab
     libc.src.unistd.symlink
     libc.src.unistd.symlinkat
     libc.src.unistd.sysconf
@@ -464,6 +463,7 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.unistd.optind
     libc.src.unistd.optopt
     libc.src.unistd.opterr
+    libc.src.unistd.swab
 
     # sys/select.h entrypoints
     libc.src.sys.select.select

diff  --git a/libc/config/linux/riscv64/entrypoints.txt b/libc/config/linux/riscv64/entrypoints.txt
index 936949f779af7..ff741ed31bb03 100644
--- a/libc/config/linux/riscv64/entrypoints.txt
+++ b/libc/config/linux/riscv64/entrypoints.txt
@@ -191,7 +191,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.readlink
     libc.src.unistd.readlinkat
     libc.src.unistd.rmdir
-    libc.src.unistd.swab
     libc.src.unistd.symlink
     libc.src.unistd.symlinkat
     libc.src.unistd.sysconf
@@ -494,6 +493,7 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.unistd.optind
     libc.src.unistd.optopt
     libc.src.unistd.opterr
+    libc.src.unistd.swab
 
     # sys/select.h entrypoints
     libc.src.sys.select.select

diff  --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 9e450eadc9d4e..bc98b47d3b3a2 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -193,7 +193,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.readlink
     libc.src.unistd.readlinkat
     libc.src.unistd.rmdir
-    libc.src.unistd.swab
     libc.src.unistd.symlink
     libc.src.unistd.symlinkat
     libc.src.unistd.sysconf
@@ -507,6 +506,7 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.unistd.optind
     libc.src.unistd.optopt
     libc.src.unistd.opterr
+    libc.src.unistd.swab
 
     # sys/select.h entrypoints
     libc.src.sys.select.select

diff  --git a/libc/src/unistd/CMakeLists.txt b/libc/src/unistd/CMakeLists.txt
index 261e16ef8b484..1eb653d6f138b 100644
--- a/libc/src/unistd/CMakeLists.txt
+++ b/libc/src/unistd/CMakeLists.txt
@@ -191,13 +191,6 @@ add_entrypoint_object(
     .${LIBC_TARGET_OS}.rmdir
 )
 
-add_entrypoint_object(
-  swab
-  ALIAS
-  DEPENDS
-    .${LIBC_TARGET_OS}.swab
-)
-
 add_entrypoint_object(
   symlink
   ALIAS
@@ -276,6 +269,17 @@ add_entrypoint_object(
     libc.src.stdio.fprintf
 )
 
+add_entrypoint_object(
+  swab
+  SRCS
+    swab.cpp
+  HDRS
+    swab.h
+  DEPENDS
+    libc.include.unistd
+    libc.src.__support.CPP.optional
+)
+
 # These aren't actual external per-se, but this is just an easy way to create
 # targets that don't do anything. They exist to be referenced in entrypoints.txt
 # so that the header will properly expose their definitions. Their declaration

diff  --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt
index 8ca5d59e6739f..2507e1e9a9387 100644
--- a/libc/src/unistd/linux/CMakeLists.txt
+++ b/libc/src/unistd/linux/CMakeLists.txt
@@ -353,14 +353,6 @@ add_entrypoint_object(
     libc.src.errno.errno
 )
 
-add_entrypoint_object(
-  swab
-  SRCS
-    swab.cpp
-  HDRS
-    ../swab.h
-)
-
 add_entrypoint_object(
   symlink
   SRCS

diff  --git a/libc/src/unistd/linux/swab.cpp b/libc/src/unistd/swab.cpp
similarity index 100%
rename from libc/src/unistd/linux/swab.cpp
rename to libc/src/unistd/swab.cpp


        


More information about the libc-commits mailing list