[libc-commits] [libc] [libc] Fix missing strings symbols in string.h (PR #192640)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Fri Apr 17 04:48:50 PDT 2026


https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/192640

The glibc string.h includes strings.h if it's in the default mode. Added
to allow more programs to be built.


>From eb4dc4d6cc0436c85f1aa3c122a464ccc2fc6197 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Fri, 17 Apr 2026 11:44:53 +0000
Subject: [PATCH] [libc] Fix missing strings symbols in string.h

The glibc string.h includes strings.h if it's in the default mode. Added
to allow more programs to be built.
---
 libc/include/string.h.def | 21 +++++++++++++++++++++
 libc/include/string.yaml  |  1 +
 2 files changed, 22 insertions(+)
 create mode 100644 libc/include/string.h.def

diff --git a/libc/include/string.h.def b/libc/include/string.h.def
new file mode 100644
index 0000000000000..3c6a9ac90dee1
--- /dev/null
+++ b/libc/include/string.h.def
@@ -0,0 +1,21 @@
+//===-- stdc header string.h ----------------------------------------------===//
+//
+// 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_STRING_H
+#define LLVM_LIBC_STRING_H
+
+#include "__llvm-libc-common.h"
+
+// TODO: Needed for compatibility with glibc which provides these symbols by
+// default. Would be better in the yaml file but there's no way to represent
+// including another header in yaml right now.
+#include <strings.h>
+
+%%public_api()
+
+#endif // LLVM_LIBC_STRING_H
diff --git a/libc/include/string.yaml b/libc/include/string.yaml
index 7711b0d148a98..c0a96e58dbc94 100644
--- a/libc/include/string.yaml
+++ b/libc/include/string.yaml
@@ -1,4 +1,5 @@
 header: string.h
+header_template: string.h.def
 standards:
   - stdc
 macros:



More information about the libc-commits mailing list