|
| 1 | +Subject: [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection |
| 2 | +Date: Tue, 8 Feb 2022 13:19:37 -0800 [thread overview] |
| 3 | +Message-ID: < [email protected]> (raw) |
| 4 | + |
| 5 | +When doing RV qemu builds with host gcc 11.2, ran into following build failure |
| 6 | + |
| 7 | +| cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \ |
| 8 | +| -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \ |
| 9 | +| -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \ |
| 10 | +| -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \ |
| 11 | +| -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \ |
| 12 | +| -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \ |
| 13 | +| -fno-stack-protector -m16 -Wa,-32 \ |
| 14 | +| -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o |
| 15 | +|cc1: error: ‘-fcf-protection’ is not compatible with this target |
| 16 | + |
| 17 | +Signed-off-by: Vineet Gupta < [email protected]> |
| 18 | +--- |
| 19 | +This might be a crude fix to the problem |
| 20 | +--- |
| 21 | + pc-bios/optionrom/Makefile | 3 +++ |
| 22 | + 1 file changed, 3 insertions(+) |
| 23 | + |
| 24 | +diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile |
| 25 | +index 5d55d25acca2..8f843ee803c1 100644 |
| 26 | +--- a/pc-bios/optionrom/Makefile |
| 27 | ++++ b/pc-bios/optionrom/Makefile |
| 28 | +@@ -22,6 +22,9 @@ override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include |
| 29 | + override CFLAGS += $(call cc-option, -fno-stack-protector) |
| 30 | + override CFLAGS += $(call cc-option, -m16) |
| 31 | + |
| 32 | ++# issue with gcc 11.2 |
| 33 | ++override CFLAGS += $(call cc-option, -fcf-protection=none) |
| 34 | ++ |
| 35 | + ifeq ($(filter -m16, $(CFLAGS)),) |
| 36 | + # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??) |
| 37 | + # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with |
0 commit comments