All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used
@ 2021-07-07  7:36 Bin Meng
  2021-07-07 17:33 ` Tom Rini
  2021-07-07 17:35 ` Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Bin Meng @ 2021-07-07  7:36 UTC (permalink / raw)
  To: Simon Glass, u-boot; +Cc: Bin Meng

With x86 we can execute an option ROM either natively or using the
x86 emulator (if enabled with CONFIG_BIOSEMU). Both of these share
the _X86EMU_env variable, with the native code using it to hold
register state during interrupt processing.

At present, in 32-bit U-Boot, the variable is declared twice, once
in common code and once in code only compiled with CONFIG_BIOSEMU.

With GCC 11 this causes a 'multiple definitions' error on boards
with CONFIG_BIOSEMU.

Drop the emulator definition when CONFIG_BIOSEMU is used.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/lib/bios.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
index fbdc3b04e3..98cc05de2e 100644
--- a/arch/x86/lib/bios.c
+++ b/arch/x86/lib/bios.c
@@ -23,7 +23,9 @@
 static int (*int_handler[256])(void);
 
 /* to have a common register file for interrupt handlers */
+#ifndef CONFIG_BIOSEMU
 X86EMU_sysEnv _X86EMU_env;
+#endif
 
 asmlinkage void (*realmode_call)(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx,
 				 u32 esi, u32 edi);
-- 
2.25.1


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

* Re: [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used
  2021-07-07  7:36 [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used Bin Meng
@ 2021-07-07 17:33 ` Tom Rini
  2021-07-07 17:35 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2021-07-07 17:33 UTC (permalink / raw)
  To: Bin Meng; +Cc: Simon Glass, u-boot

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

On Wed, Jul 07, 2021 at 03:36:26PM +0800, Bin Meng wrote:

> With x86 we can execute an option ROM either natively or using the
> x86 emulator (if enabled with CONFIG_BIOSEMU). Both of these share
> the _X86EMU_env variable, with the native code using it to hold
> register state during interrupt processing.
> 
> At present, in 32-bit U-Boot, the variable is declared twice, once
> in common code and once in code only compiled with CONFIG_BIOSEMU.
> 
> With GCC 11 this causes a 'multiple definitions' error on boards
> with CONFIG_BIOSEMU.
> 
> Drop the emulator definition when CONFIG_BIOSEMU is used.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used
  2021-07-07  7:36 [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used Bin Meng
  2021-07-07 17:33 ` Tom Rini
@ 2021-07-07 17:35 ` Simon Glass
  2021-07-07 23:36   ` Bin Meng
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2021-07-07 17:35 UTC (permalink / raw)
  To: Bin Meng; +Cc: U-Boot Mailing List

Hi Bin,

On Wed, 7 Jul 2021 at 01:36, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> With x86 we can execute an option ROM either natively or using the
> x86 emulator (if enabled with CONFIG_BIOSEMU). Both of these share
> the _X86EMU_env variable, with the native code using it to hold
> register state during interrupt processing.
>
> At present, in 32-bit U-Boot, the variable is declared twice, once
> in common code and once in code only compiled with CONFIG_BIOSEMU.
>
> With GCC 11 this causes a 'multiple definitions' error on boards
> with CONFIG_BIOSEMU.
>
> Drop the emulator definition when CONFIG_BIOSEMU is used.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/lib/bios.c | 2 ++
>  1 file changed, 2 insertions(+)

This seems a bit hacky. Should we define a new Kconfig that both use,
then put this declaration in a common file?
>
> diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
> index fbdc3b04e3..98cc05de2e 100644
> --- a/arch/x86/lib/bios.c
> +++ b/arch/x86/lib/bios.c
> @@ -23,7 +23,9 @@
>  static int (*int_handler[256])(void);
>
>  /* to have a common register file for interrupt handlers */
> +#ifndef CONFIG_BIOSEMU
>  X86EMU_sysEnv _X86EMU_env;
> +#endif
>
>  asmlinkage void (*realmode_call)(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx,
>                                  u32 esi, u32 edi);
> --
> 2.25.1
>

Regards,
Simon

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

* Re: [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used
  2021-07-07 17:35 ` Simon Glass
@ 2021-07-07 23:36   ` Bin Meng
  0 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2021-07-07 23:36 UTC (permalink / raw)
  To: Simon Glass; +Cc: U-Boot Mailing List

Hi Simon,

On Thu, Jul 8, 2021 at 1:35 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Wed, 7 Jul 2021 at 01:36, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > With x86 we can execute an option ROM either natively or using the
> > x86 emulator (if enabled with CONFIG_BIOSEMU). Both of these share
> > the _X86EMU_env variable, with the native code using it to hold
> > register state during interrupt processing.
> >
> > At present, in 32-bit U-Boot, the variable is declared twice, once
> > in common code and once in code only compiled with CONFIG_BIOSEMU.
> >
> > With GCC 11 this causes a 'multiple definitions' error on boards
> > with CONFIG_BIOSEMU.
> >
> > Drop the emulator definition when CONFIG_BIOSEMU is used.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  arch/x86/lib/bios.c | 2 ++
> >  1 file changed, 2 insertions(+)
>
> This seems a bit hacky. Should we define a new Kconfig that both use,
> then put this declaration in a common file?

Yes, that's what I thought so. We can do this later. Currently this is
to unblock the GCC 11 CI testing.

Regards,
Bin

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

end of thread, other threads:[~2021-07-07 23:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  7:36 [PATCH] x86: Drop _X86EMU_env definition when CONFIG_BIOSEMU is used Bin Meng
2021-07-07 17:33 ` Tom Rini
2021-07-07 17:35 ` Simon Glass
2021-07-07 23:36   ` Bin Meng

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.