]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch
syslinux: Fix build with GCC 10
[people/pmueller/ipfire-2.x.git] / src / patches / syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch
1 diff --git a/dos/string.h b/dos/string.h
2 index f648de2d..407d0233 100644
3 --- a/dos/string.h
4 +++ b/dos/string.h
5 @@ -5,12 +5,22 @@
6 #ifndef _STRING_H
7 #define _STRING_H
8
9 +#include <stddef.h>
10 +
11 /* Standard routines */
12 #define memcpy(a,b,c) __builtin_memcpy(a,b,c)
13 #define memmove(a,b,c) __builtin_memmove(a,b,c)
14 #define memset(a,b,c) __builtin_memset(a,b,c)
15 #define strcpy(a,b) __builtin_strcpy(a,b)
16 -#define strlen(a) __builtin_strlen(a)
17 +#define strlen(a) inline_strlen(a)
18 +
19 +/* replacement for builtin strlen that appears to get optimized away */
20 +static inline size_t inline_strlen(const char *str)
21 +{
22 + size_t l;
23 + for (l = 0; *str++; l++);
24 + return l;
25 +}
26
27 /* This only returns true or false */
28 static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)