* [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection
@ 2022-02-08 21:19 ` Vineet Gupta
0 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2022-02-08 21:19 UTC (permalink / raw)
To: qemu-devel
Cc: Vineet Gupta, Palmer Dabbelt, Alistair Francis, qemu-riscv,
gnu-toolchain
When doing RV qemu builds with host gcc 11.2, ran into following build failure
| cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \
| -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \
| -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \
| -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \
| -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \
| -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \
| -fno-stack-protector -m16 -Wa,-32 \
| -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o
|cc1: error: ‘-fcf-protection’ is not compatible with this target
Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
---
This might be a crude fix to the problem
---
pc-bios/optionrom/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 5d55d25acca2..8f843ee803c1 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -22,6 +22,9 @@ override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
override CFLAGS += $(call cc-option, -fno-stack-protector)
override CFLAGS += $(call cc-option, -m16)
+# issue with gcc 11.2
+override CFLAGS += $(call cc-option, -fcf-protection=none)
+
ifeq ($(filter -m16, $(CFLAGS)),)
# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection
@ 2022-02-08 21:19 ` Vineet Gupta
0 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2022-02-08 21:19 UTC (permalink / raw)
To: qemu-devel
Cc: Alistair Francis, Palmer Dabbelt, qemu-riscv, gnu-toolchain,
Vineet Gupta
When doing RV qemu builds with host gcc 11.2, ran into following build failure
| cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \
| -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \
| -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \
| -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \
| -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \
| -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \
| -fno-stack-protector -m16 -Wa,-32 \
| -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o
|cc1: error: ‘-fcf-protection’ is not compatible with this target
Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
---
This might be a crude fix to the problem
---
pc-bios/optionrom/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 5d55d25acca2..8f843ee803c1 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -22,6 +22,9 @@ override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
override CFLAGS += $(call cc-option, -fno-stack-protector)
override CFLAGS += $(call cc-option, -m16)
+# issue with gcc 11.2
+override CFLAGS += $(call cc-option, -fcf-protection=none)
+
ifeq ($(filter -m16, $(CFLAGS)),)
# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection
2022-02-08 21:19 ` Vineet Gupta
@ 2022-02-18 13:13 ` Peter Maydell
-1 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2022-02-18 13:13 UTC (permalink / raw)
To: Vineet Gupta
Cc: Alistair Francis, gnu-toolchain, Palmer Dabbelt, qemu-devel, qemu-riscv
On Tue, 8 Feb 2022 at 21:29, Vineet Gupta <vineetg@rivosinc.com> wrote:
>
> When doing RV qemu builds with host gcc 11.2, ran into following build failure
>
> | cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \
> | -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \
> | -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \
> | -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \
> | -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \
> | -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \
> | -fno-stack-protector -m16 -Wa,-32 \
> | -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o
> |cc1: error: ‘-fcf-protection’ is not compatible with this target
>
> Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
> ---
> This might be a crude fix to the problem
I think this patch
https://patchew.org/QEMU/20220103090112.312202-1-bjorn@kernel.org/
fixes the same problem...
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection
@ 2022-02-18 13:13 ` Peter Maydell
0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2022-02-18 13:13 UTC (permalink / raw)
To: Vineet Gupta
Cc: qemu-devel, Palmer Dabbelt, Alistair Francis, qemu-riscv, gnu-toolchain
On Tue, 8 Feb 2022 at 21:29, Vineet Gupta <vineetg@rivosinc.com> wrote:
>
> When doing RV qemu builds with host gcc 11.2, ran into following build failure
>
> | cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \
> | -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \
> | -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \
> | -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \
> | -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \
> | -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \
> | -fno-stack-protector -m16 -Wa,-32 \
> | -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o
> |cc1: error: ‘-fcf-protection’ is not compatible with this target
>
> Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
> ---
> This might be a crude fix to the problem
I think this patch
https://patchew.org/QEMU/20220103090112.312202-1-bjorn@kernel.org/
fixes the same problem...
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection
2022-02-08 21:19 ` Vineet Gupta
@ 2022-02-18 15:47 ` Paolo Bonzini
-1 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-02-18 15:47 UTC (permalink / raw)
To: Vineet Gupta, qemu-devel
Cc: Alistair Francis, Palmer Dabbelt, qemu-riscv, gnu-toolchain
On 2/8/22 22:19, Vineet Gupta wrote:
> When doing RV qemu builds with host gcc 11.2, ran into following build failure
>
> | cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \
> | -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \
> | -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \
> | -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \
> | -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \
> | -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \
> | -fno-stack-protector -m16 -Wa,-32 \
> | -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o
> |cc1: error: ‘-fcf-protection’ is not compatible with this target
>
> Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
> ---
> This might be a crude fix to the problem
> ---
> pc-bios/optionrom/Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> index 5d55d25acca2..8f843ee803c1 100644
> --- a/pc-bios/optionrom/Makefile
> +++ b/pc-bios/optionrom/Makefile
> @@ -22,6 +22,9 @@ override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
> override CFLAGS += $(call cc-option, -fno-stack-protector)
> override CFLAGS += $(call cc-option, -m16)
>
> +# issue with gcc 11.2
> +override CFLAGS += $(call cc-option, -fcf-protection=none)
> +
> ifeq ($(filter -m16, $(CFLAGS)),)
> # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
> # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
This is a problem in the Ubuntu compiler that you're using. If
-fcf-protection is not compatible with -m16, Ubuntu should not enable it
instead of breaking -m16.
Besides, QEMU is not at all compatible with -fcf-protection, not just
the ROMs. So it should be added to QEMU_CFLAGS in configure as well.
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection
@ 2022-02-18 15:47 ` Paolo Bonzini
0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-02-18 15:47 UTC (permalink / raw)
To: Vineet Gupta, qemu-devel
Cc: Palmer Dabbelt, Alistair Francis, qemu-riscv, gnu-toolchain
On 2/8/22 22:19, Vineet Gupta wrote:
> When doing RV qemu builds with host gcc 11.2, ran into following build failure
>
> | cc -MMD -MP -MT linuxboot_dma.o -MF ./linuxboot_dma.d -O2 -g -march=i486 -Wall \
> | -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes \
> | -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security \
> | -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs \
> | -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs \
> | -Wno-shift-negative-value -Wno-psabi -fno-pie -ffreestanding -IQEMU/include \
> | -fno-stack-protector -m16 -Wa,-32 \
> | -c QEMU/pc-bios/optionrom/linuxboot_dma.c -o linuxboot_dma.o
> |cc1: error: ‘-fcf-protection’ is not compatible with this target
>
> Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
> ---
> This might be a crude fix to the problem
> ---
> pc-bios/optionrom/Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> index 5d55d25acca2..8f843ee803c1 100644
> --- a/pc-bios/optionrom/Makefile
> +++ b/pc-bios/optionrom/Makefile
> @@ -22,6 +22,9 @@ override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
> override CFLAGS += $(call cc-option, -fno-stack-protector)
> override CFLAGS += $(call cc-option, -m16)
>
> +# issue with gcc 11.2
> +override CFLAGS += $(call cc-option, -fcf-protection=none)
> +
> ifeq ($(filter -m16, $(CFLAGS)),)
> # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
> # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
This is a problem in the Ubuntu compiler that you're using. If
-fcf-protection is not compatible with -m16, Ubuntu should not enable it
instead of breaking -m16.
Besides, QEMU is not at all compatible with -fcf-protection, not just
the ROMs. So it should be added to QEMU_CFLAGS in configure as well.
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-18 15:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 21:19 [PATCH] build: fix build failure with gcc 11.2 by disabling -fcf-protection Vineet Gupta
2022-02-08 21:19 ` Vineet Gupta
2022-02-18 13:13 ` Peter Maydell
2022-02-18 13:13 ` Peter Maydell
2022-02-18 15:47 ` Paolo Bonzini
2022-02-18 15:47 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.