[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:55:39 PDT 2026
https://github.com/michaelrj-google updated https://github.com/llvm/llvm-project/pull/192640
>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 1/2] [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:
>From 2cf068f482e60e7da4e58670f18757df8c1444af Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Fri, 17 Apr 2026 11:54:59 +0000
Subject: [PATCH 2/2] fix copyright header phrasing
---
libc/include/string.h.def | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/include/string.h.def b/libc/include/string.h.def
index 3c6a9ac90dee1..d70254193dafe 100644
--- a/libc/include/string.h.def
+++ b/libc/include/string.h.def
@@ -1,4 +1,4 @@
-//===-- stdc header string.h ----------------------------------------------===//
+//===-- C standard library header 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.
More information about the libc-commits
mailing list