[libc-commits] [libc] [libc] fix getchar_unlocked (PR #73874)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Thu Nov 30 08:17:46 PST 2023


https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/73874

>From 4170b301b119b002f6206451e5911872265eaa8d Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Wed, 29 Nov 2023 16:03:14 -0800
Subject: [PATCH 1/2] [libc] fix getchar_unlocked

A typo was leading to getc_unlocked.cpp.o being included into libc.a twice.

I only noticed because I was trying to convert libc.a to a shared object via

$ ld.lld -o libc.so --whole-archive libc.a

which errored since getc_unlocked was being defined twice.
---
 libc/src/stdio/generic/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/stdio/generic/CMakeLists.txt b/libc/src/stdio/generic/CMakeLists.txt
index 2ecef879eb4bbfe..67fd1337c90a134 100644
--- a/libc/src/stdio/generic/CMakeLists.txt
+++ b/libc/src/stdio/generic/CMakeLists.txt
@@ -319,7 +319,7 @@ add_entrypoint_object(
 add_entrypoint_object(
   getchar_unlocked
   SRCS
-    getc_unlocked.cpp
+    getchar_unlocked.cpp
   HDRS
     ../getc_unlocked.h
   DEPENDS

>From f51ea4b9e009f449cd4008e4e62eaa43e77ec10d Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 30 Nov 2023 08:17:29 -0800
Subject: [PATCH 2/2] fix header too

---
 libc/src/stdio/generic/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/stdio/generic/CMakeLists.txt b/libc/src/stdio/generic/CMakeLists.txt
index 67fd1337c90a134..4e4a709e94061b9 100644
--- a/libc/src/stdio/generic/CMakeLists.txt
+++ b/libc/src/stdio/generic/CMakeLists.txt
@@ -321,7 +321,7 @@ add_entrypoint_object(
   SRCS
     getchar_unlocked.cpp
   HDRS
-    ../getc_unlocked.h
+    ../getchar_unlocked.h
   DEPENDS
     libc.src.errno.errno
     libc.include.stdio



More information about the libc-commits mailing list