Contents of /trunk/syslinux/patches/syslinux-6.04_pre1-0003-GCC-10-compatibility-patch.patch
Parent Directory | Revision Log
Revision 3783 -
(show annotations)
(download)
Wed Sep 27 14:04:48 2023 UTC (7 months, 2 weeks ago) by niro
File size: 3356 byte(s)
Wed Sep 27 14:04:48 2023 UTC (7 months, 2 weeks ago) by niro
File size: 3356 byte(s)
-syslinux-6.04_pre1 patches
1 | From b92e6e8f624c96acf2ce80192a893ee25de527a1 Mon Sep 17 00:00:00 2001 |
2 | From: Lukas Schwaighofer <lukas@schwaighofer.name> |
3 | Date: Sun, 16 Aug 2020 15:23:21 +0200 |
4 | Subject: [PATCH 3/5] GCC-10 compatibility patch |
5 | |
6 | * Add `-fcommon` to most gcc invocations to allow duplicate definitions |
7 | * __builtin_strlen is not really a "builtin" an implementation still |
8 | needs to be provided (source: |
9 | https://bugzilla.suse.com/show_bug.cgi?id=1166605#c5). Work around the |
10 | issue by supplying an inline function. The strlen function added to |
11 | dos/string.h was copied from com32/lib/strlen.c. |
12 | --- |
13 | dos/string.h | 11 ++++++++++- |
14 | mk/efi.mk | 1 + |
15 | mk/elf.mk | 1 + |
16 | mk/embedded.mk | 2 +- |
17 | mk/lib.mk | 2 +- |
18 | 5 files changed, 14 insertions(+), 3 deletions(-) |
19 | |
20 | diff --git a/dos/string.h b/dos/string.h |
21 | index f648de2d..c4649f5f 100644 |
22 | --- a/dos/string.h |
23 | +++ b/dos/string.h |
24 | @@ -5,12 +5,21 @@ |
25 | #ifndef _STRING_H |
26 | #define _STRING_H |
27 | |
28 | +#include <stddef.h> |
29 | + |
30 | /* Standard routines */ |
31 | #define memcpy(a,b,c) __builtin_memcpy(a,b,c) |
32 | #define memmove(a,b,c) __builtin_memmove(a,b,c) |
33 | #define memset(a,b,c) __builtin_memset(a,b,c) |
34 | #define strcpy(a,b) __builtin_strcpy(a,b) |
35 | -#define strlen(a) __builtin_strlen(a) |
36 | + |
37 | +static inline size_t strlen(const char *s) |
38 | +{ |
39 | + const char *ss = s; |
40 | + while (*ss) |
41 | + ss++; |
42 | + return ss - s; |
43 | +} |
44 | |
45 | /* This only returns true or false */ |
46 | static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n) |
47 | diff --git a/mk/efi.mk b/mk/efi.mk |
48 | index f097ad22..407bc077 100644 |
49 | --- a/mk/efi.mk |
50 | +++ b/mk/efi.mk |
51 | @@ -25,6 +25,7 @@ FORMAT=efi-app-$(EFI_SUBARCH) |
52 | |
53 | CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \ |
54 | -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \ |
55 | + -fcommon \ |
56 | -Wall -I$(com32)/include -I$(com32)/include/sys \ |
57 | -I$(core)/include -I$(core)/ $(ARCHOPT) \ |
58 | -I$(com32)/lib/ -I$(com32)/libutil/include -std=gnu99 \ |
59 | diff --git a/mk/elf.mk b/mk/elf.mk |
60 | index b46dbd06..dc265ce9 100644 |
61 | --- a/mk/elf.mk |
62 | +++ b/mk/elf.mk |
63 | @@ -55,6 +55,7 @@ GPLINCLUDE = |
64 | endif |
65 | |
66 | CFLAGS = $(GCCOPT) $(GCCWARN) -W -Wall \ |
67 | + -fcommon \ |
68 | -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ -DDYNAMIC_MODULE \ |
69 | -nostdinc -iwithprefix include \ |
70 | -I$(com32)/libutil/include -I$(com32)/include \ |
71 | diff --git a/mk/embedded.mk b/mk/embedded.mk |
72 | index 488dc0fc..fae13e20 100644 |
73 | --- a/mk/embedded.mk |
74 | +++ b/mk/embedded.mk |
75 | @@ -57,7 +57,7 @@ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) |
76 | LD += -m elf_$(ARCH) |
77 | |
78 | # Note: use += for CFLAGS and SFLAGS in case something is set in MCONFIG.local |
79 | -CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES) |
80 | +CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare -fcommon $(OPTFLAGS) $(INCLUDES) |
81 | SFLAGS += $(CFLAGS) -D__ASSEMBLY__ |
82 | |
83 | .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss |
84 | diff --git a/mk/lib.mk b/mk/lib.mk |
85 | index f8591e56..6dd54295 100644 |
86 | --- a/mk/lib.mk |
87 | +++ b/mk/lib.mk |
88 | @@ -49,7 +49,7 @@ OPTFLAGS = -Os -march=$(MARCH) -falign-functions=0 -falign-jumps=0 \ |
89 | -falign-labels=0 -ffast-math -fomit-frame-pointer |
90 | WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline |
91 | |
92 | -CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS) |
93 | +CFLAGS = $(OPTFLAGS) $(REQFLAGS) -fcommon $(WARNFLAGS) $(LIBFLAGS) |
94 | |
95 | ifeq ($(FWCLASS),EFI) |
96 | CFLAGS += -mno-red-zone |
97 | -- |
98 | 2.35.1 |
99 |