All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] build: disable fcf-protection on -march=486 -m16
@ 2022-03-23  9:07 christian.ehrhardt
  2022-03-23  9:45 ` Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: christian.ehrhardt @ 2022-03-23  9:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Christian Ehrhardt

From: Christian Ehrhardt <christian.ehrhardt@canonical.com>

Some of the roms build with -march=i486 -m16 which is incompatible
with -fcf-protection. That in turn is can be set by default, for
example in Ubuntu [1].
That causes:
 cc1: error: ‘-fcf-protection’ is not compatible with this target

This won't work on -march=i486 -m16 and no matter if set or not we can
override it to "none" if the option is known to the compiler to be
able to build reliably.

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/889

[1]: https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-fcf-protection

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 pc-bios/optionrom/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 5d55d25acc..f1ef898073 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -14,6 +14,10 @@ cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1
 
 override CFLAGS += -march=i486 -Wall
 
+# If -fcf-protection is enabled in flags or compiler defaults that will
+# conflict with -march=i486
+override CFLAGS += $(call cc-option, -fcf-protection=none)
+
 # Flags for dependency generation
 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: disable fcf-protection on -march=486 -m16
  2022-03-23  9:07 [PATCH] build: disable fcf-protection on -march=486 -m16 christian.ehrhardt
@ 2022-03-23  9:45 ` Thomas Huth
  2022-03-23 10:54 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
  2022-03-24 17:44 ` [PATCH] " Paolo Bonzini
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2022-03-23  9:45 UTC (permalink / raw)
  To: christian.ehrhardt, qemu-devel, Paolo Bonzini
  Cc: QEMU Trivial, qemu-stable, Michael S. Tsirkin

On 23/03/2022 10.07, christian.ehrhardt@canonical.com wrote:
> From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> 
> Some of the roms build with -march=i486 -m16 which is incompatible
> with -fcf-protection. That in turn is can be set by default, for
> example in Ubuntu [1].
> That causes:
>   cc1: error: ‘-fcf-protection’ is not compatible with this target
> 
> This won't work on -march=i486 -m16 and no matter if set or not we can
> override it to "none" if the option is known to the compiler to be
> able to build reliably.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/889
> 
> [1]: https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-fcf-protection
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>   pc-bios/optionrom/Makefile | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> index 5d55d25acc..f1ef898073 100644
> --- a/pc-bios/optionrom/Makefile
> +++ b/pc-bios/optionrom/Makefile
> @@ -14,6 +14,10 @@ cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1
>   
>   override CFLAGS += -march=i486 -Wall
>   
> +# If -fcf-protection is enabled in flags or compiler defaults that will
> +# conflict with -march=i486
> +override CFLAGS += $(call cc-option, -fcf-protection=none)
> +
>   # Flags for dependency generation
>   override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
>   

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-7.0] build: disable fcf-protection on -march=486 -m16
  2022-03-23  9:07 [PATCH] build: disable fcf-protection on -march=486 -m16 christian.ehrhardt
  2022-03-23  9:45 ` Thomas Huth
@ 2022-03-23 10:54 ` Philippe Mathieu-Daudé
  2022-03-24  8:26   ` Christian Ehrhardt
  2022-03-24 17:44 ` [PATCH] " Paolo Bonzini
  2 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-03-23 10:54 UTC (permalink / raw)
  To: christian.ehrhardt, qemu-devel; +Cc: Thomas Huth

On 23/3/22 10:07, christian.ehrhardt@canonical.com wrote:
> From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> 
> Some of the roms build with -march=i486 -m16 which is incompatible
> with -fcf-protection. That in turn is can be set by default, for
> example in Ubuntu [1].
> That causes:
>   cc1: error: ‘-fcf-protection’ is not compatible with this target
> 
> This won't work on -march=i486 -m16 and no matter if set or not we can
> override it to "none" if the option is known to the compiler to be
> able to build reliably.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/889
> 
> [1]: https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-fcf-protection
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>   pc-bios/optionrom/Makefile | 4 ++++
>   1 file changed, 4 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-7.0] build: disable fcf-protection on -march=486 -m16
  2022-03-23 10:54 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
@ 2022-03-24  8:26   ` Christian Ehrhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Ehrhardt @ 2022-03-24  8:26 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Thomas Huth, qemu-devel

On Wed, Mar 23, 2022 at 11:54 AM Philippe Mathieu-Daudé
<philippe.mathieu.daude@gmail.com> wrote:
>
> On 23/3/22 10:07, christian.ehrhardt@canonical.com wrote:
> > From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> >
> > Some of the roms build with -march=i486 -m16 which is incompatible
> > with -fcf-protection. That in turn is can be set by default, for
> > example in Ubuntu [1].
> > That causes:
> >   cc1: error: ‘-fcf-protection’ is not compatible with this target
> >
> > This won't work on -march=i486 -m16 and no matter if set or not we can
> > override it to "none" if the option is known to the compiler to be
> > able to build reliably.
> >
> > Fixes: https://gitlab.com/qemu-project/qemu/-/issues/889
> >
> > [1]: https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-fcf-protection
> >
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >   pc-bios/optionrom/Makefile | 4 ++++
> >   1 file changed, 4 insertions(+)
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thank you for the review Thomas and Philippe!
For the sake of testing other than my local build checks, the CI jobs
on [1] on gitlab also all passed for this.

[1]: https://gitlab.com/paelzer/qemu/-/pipelines/498917375

-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: disable fcf-protection on -march=486 -m16
  2022-03-23  9:07 [PATCH] build: disable fcf-protection on -march=486 -m16 christian.ehrhardt
  2022-03-23  9:45 ` Thomas Huth
  2022-03-23 10:54 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
@ 2022-03-24 17:44 ` Paolo Bonzini
  2 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2022-03-24 17:44 UTC (permalink / raw)
  To: christian.ehrhardt; +Cc: Thomas Huth, qemu-devel

Queued, thanks.

Paolo




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-24 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23  9:07 [PATCH] build: disable fcf-protection on -march=486 -m16 christian.ehrhardt
2022-03-23  9:45 ` Thomas Huth
2022-03-23 10:54 ` [PATCH-for-7.0] " Philippe Mathieu-Daudé
2022-03-24  8:26   ` Christian Ehrhardt
2022-03-24 17:44 ` [PATCH] " 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.