[PATCH] optionrom: Turn off -fcf-protection

Björn Töpel posted 1 patch 2 years, 4 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220103090112.312202-1-bjorn@kernel.org
pc-bios/optionrom/Makefile | 1 +
1 file changed, 1 insertion(+)
[PATCH] optionrom: Turn off -fcf-protection
Posted by Björn Töpel 2 years, 4 months ago
Ubuntu GCC enables -fcf-protection globally, which is not supported
for x86 16-bit (realmode). This causes the build to fail.

This commit turns off that option.

Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
 pc-bios/optionrom/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 5d55d25acca2..c5f5fa02ef06 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -21,6 +21,7 @@ override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
 override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
 override CFLAGS += $(call cc-option, -fno-stack-protector)
 override CFLAGS += $(call cc-option, -m16)
+override CFLAGS += $(call cc-option, -fcf-protection=none)
 
 ifeq ($(filter -m16, $(CFLAGS)),)
 # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
-- 
2.32.0


Re: [PATCH] optionrom: Turn off -fcf-protection
Posted by Stefano Garzarella 2 years, 4 months ago
CCing Paolo

On Mon, Jan 03, 2022 at 10:01:12AM +0100, Björn Töpel wrote:
>Ubuntu GCC enables -fcf-protection globally, which is not supported
>for x86 16-bit (realmode). This causes the build to fail.
>
>This commit turns off that option.
>
>Signed-off-by: Björn Töpel <bjorn@kernel.org>
>---
> pc-bios/optionrom/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
>index 5d55d25acca2..c5f5fa02ef06 100644
>--- a/pc-bios/optionrom/Makefile
>+++ b/pc-bios/optionrom/Makefile
>@@ -21,6 +21,7 @@ override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
> override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
> override CFLAGS += $(call cc-option, -fno-stack-protector)
> override CFLAGS += $(call cc-option, -m16)
>+override CFLAGS += $(call cc-option, -fcf-protection=none)

LGTM!

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>