Blame SOURCES/0006-Replace-builtin-strlen-that-appears-to-get-optimized.patch

87e39f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
0860da
From: Merlin Mathesius <mmathesi@redhat.com>
0860da
Date: Wed, 13 May 2020 11:58:37 -0500
0860da
Subject: [PATCH] Replace builtin strlen that appears to get optimized away
0860da
0860da
---
0860da
 dos/string.h | 12 +++++++++++-
0860da
 1 file changed, 11 insertions(+), 1 deletion(-)
0860da
0860da
diff --git a/dos/string.h b/dos/string.h
0860da
index f648de2d..407d0233 100644
0860da
--- a/dos/string.h
0860da
+++ b/dos/string.h
0860da
@@ -5,12 +5,22 @@
0860da
 #ifndef _STRING_H
0860da
 #define _STRING_H
0860da
 
0860da
+#include <stddef.h>
0860da
+
0860da
 /* Standard routines */
0860da
 #define memcpy(a,b,c)	__builtin_memcpy(a,b,c)
0860da
 #define memmove(a,b,c)	__builtin_memmove(a,b,c)
0860da
 #define memset(a,b,c)	__builtin_memset(a,b,c)
0860da
 #define strcpy(a,b)	__builtin_strcpy(a,b)
0860da
-#define strlen(a)	__builtin_strlen(a)
0860da
+#define strlen(a)	inline_strlen(a)
0860da
+
0860da
+/* replacement for builtin strlen that appears to get optimized away */
0860da
+static inline size_t inline_strlen(const char *str)
0860da
+{
0860da
+    size_t l;
0860da
+    for (l = 0; *str++; l++);
0860da
+    return l;
0860da
+}
0860da
 
0860da
 /* This only returns true or false */
0860da
 static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)