From 856fd16ac6eb778009c8845ce33b07882c6cb87b Mon Sep 17 00:00:00 2001 From: jzm369 Date: Sun, 7 Feb 2021 15:37:02 +0800 Subject: [PATCH] add patch to replace builtin strlen --- ...strlen-that-appears-to-get-optimized.patch | 39 +++++++++++++++++++ syslinux.spec | 7 +++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 backport-replace-builtin-strlen-that-appears-to-get-optimized.patch diff --git a/backport-replace-builtin-strlen-that-appears-to-get-optimized.patch b/backport-replace-builtin-strlen-that-appears-to-get-optimized.patch new file mode 100644 index 0000000..8db9436 --- /dev/null +++ b/backport-replace-builtin-strlen-that-appears-to-get-optimized.patch @@ -0,0 +1,39 @@ +From eae06bdce9468d7fde263de1c53f80f2faff0c9e Mon Sep 17 00:00:00 2001 +From: Merlin Mathesius +Date: Wed, 13 May 2020 11:58:37 -0500 +Subject: [PATCH] Replace builtin strlen that appears to get optimized away + +--- + dos/string.h | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/dos/string.h b/dos/string.h +index f648de2d..407d0233 100644 +--- a/dos/string.h ++++ b/dos/string.h +@@ -5,12 +5,22 @@ + #ifndef _STRING_H + #define _STRING_H + ++#include ++ + /* Standard routines */ + #define memcpy(a,b,c) __builtin_memcpy(a,b,c) + #define memmove(a,b,c) __builtin_memmove(a,b,c) + #define memset(a,b,c) __builtin_memset(a,b,c) + #define strcpy(a,b) __builtin_strcpy(a,b) +-#define strlen(a) __builtin_strlen(a) ++#define strlen(a) inline_strlen(a) ++ ++/* replacement for builtin strlen that appears to get optimized away */ ++static inline size_t inline_strlen(const char *str) ++{ ++ size_t l; ++ for (l = 0; *str++; l++); ++ return l; ++} + + /* This only returns true or false */ + static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n) +-- +2.25.1 \ No newline at end of file diff --git a/syslinux.spec b/syslinux.spec index 62d6111..f9e121b 100644 --- a/syslinux.spec +++ b/syslinux.spec @@ -2,7 +2,7 @@ Name: syslinux Version: 6.04 -Release: 5 +Release: 6 License: GPLv2+ Summary: The Syslinux boot loader collection URL: http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project @@ -23,6 +23,8 @@ Patch0002: 0002-ext4-64bit-feature.patch # Frome: https://raw.githubusercontent.com/JeffreyALaw/Fedora-syslinux/master/0003-include-sysmacros-h.patch Patch0003: 0003-include-sysmacros-h.patch +Patch0004: backport-replace-builtin-strlen-that-appears-to-get-optimized.patch + %description The Syslinux Project covers lightweight bootloaders for MS-DOS FAT filesystems (SYSLINUX), network booting (PXELINUX), bootable "El Torito" CD-ROMs (ISOLINUX), and Linux ext2/ext3/ext4 @@ -164,6 +166,9 @@ fi %{_datadir}/doc/syslinux/sample/sample.msg %changelog +* Sun Feb 7 2021 jinzhimin - 6.04-6 +- add patch to replace builtin strlen + * Mon Mar 2 2020 songnannan -6.04-5 - change the path of file -- Gitee