[PATCH] D72869: Add __warn_memset_zero_len builtin as a workaround for glibc issue
serge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 16 13:07:13 PST 2020
serge-sans-paille created this revision.
serge-sans-paille added reviewers: rnk, george.burgess.iv, akhuang.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
serge-sans-paille added a comment.
@akhuang can you confirm this fixes your issue? I've tested locally and it works fine on my side.
Glibc issue: https://sourceware.org/bugzilla/show_bug.cgi?id=25399
The fix consist in considering the missing function as a builtin lowered to a nop.
See https://reviews.llvm.org/D71082 for the original discussion that led to that patch.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72869
Files:
clang/include/clang/Basic/Builtins.def
clang/lib/CodeGen/CGBuiltin.cpp
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -3222,6 +3222,8 @@
Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),
ConvertType(E->getType())));
}
+ case Builtin::BI__warn_memset_zero_len:
+ return RValue::getIgnored();
case Builtin::BI__annotation: {
// Re-encode each wide string to UTF8 and make an MDString.
SmallVector<Metadata *, 1> Strings;
Index: clang/include/clang/Basic/Builtins.def
===================================================================
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -788,6 +788,9 @@
BUILTIN(__builtin_index, "c*cC*i", "Fn")
BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
+// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+BUILTIN(__warn_memset_zero_len, "v", "nU")
+
// Microsoft builtins. These are only active with -fms-extensions.
LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72869.238588.patch
Type: text/x-patch
Size: 1188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200116/2f1c4709/attachment.bin>
More information about the cfe-commits
mailing list