All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure
@ 2020-12-03  6:10 Glenn Washburn
  2020-12-03  6:15 ` Glenn Washburn
  2020-12-04 12:30 ` Daniel Kiper
  0 siblings, 2 replies; 4+ messages in thread
From: Glenn Washburn @ 2020-12-03  6:10 UTC (permalink / raw)
  To: grub-devel; +Cc: Daniel Kiper, Glenn Washburn

This appears to be a new issue surfaced by switching from gcc 9.3.0 to
10.1.0 cross compiling toolchain. When linking these two object files
together, there is an error generated: "multiple definition of `ps2_state'".
This only appears to be an issue when --target=arm-linux-gnueabi and
--with-platform=coreboot. There's no need for these structs to have global
as opposed to file scope, so declaring them as static fixes this issue.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 grub-core/term/arm/cros.c  | 2 +-
 grub-core/term/arm/pl050.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/grub-core/term/arm/cros.c b/grub-core/term/arm/cros.c
index 1ff9f8ccf..a17e49c32 100644
--- a/grub-core/term/arm/cros.c
+++ b/grub-core/term/arm/cros.c
@@ -30,7 +30,7 @@
 #include <grub/fdtbus.h>
 #include <grub/arm/cros_ec.h>
 
-struct grub_ps2_state ps2_state;
+static struct grub_ps2_state ps2_state;
 
 struct grub_cros_ec_keyscan old_scan;
 
diff --git a/grub-core/term/arm/pl050.c b/grub-core/term/arm/pl050.c
index e4cda3056..b082243b0 100644
--- a/grub-core/term/arm/pl050.c
+++ b/grub-core/term/arm/pl050.c
@@ -29,7 +29,7 @@
 
 static volatile grub_uint32_t *pl050_regs;
 
-struct grub_ps2_state ps2_state;
+static struct grub_ps2_state ps2_state;
 
 static void
 keyboard_controller_wait_until_ready (void)
-- 
2.27.0



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

* Re: [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure
  2020-12-03  6:10 [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure Glenn Washburn
@ 2020-12-03  6:15 ` Glenn Washburn
  2020-12-03 13:47   ` Glenn Washburn
  2020-12-04 12:30 ` Daniel Kiper
  1 sibling, 1 reply; 4+ messages in thread
From: Glenn Washburn @ 2020-12-03  6:15 UTC (permalink / raw)
  To: grub-devel; +Cc: Daniel Kiper

Here is a log file showing the build failure.

https://gitlab.com/grub2-testing/grub/-/jobs/885372725/raw

On Thu,  3 Dec 2020 00:10:26 -0600
Glenn Washburn <development@efficientek.com> wrote:

> This appears to be a new issue surfaced by switching from gcc 9.3.0 to
> 10.1.0 cross compiling toolchain. When linking these two object files
> together, there is an error generated: "multiple definition of
> `ps2_state'". This only appears to be an issue when
> --target=arm-linux-gnueabi and --with-platform=coreboot. There's no
> need for these structs to have global as opposed to file scope, so
> declaring them as static fixes this issue.
> 
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
>  grub-core/term/arm/cros.c  | 2 +-
>  grub-core/term/arm/pl050.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/grub-core/term/arm/cros.c b/grub-core/term/arm/cros.c
> index 1ff9f8ccf..a17e49c32 100644
> --- a/grub-core/term/arm/cros.c
> +++ b/grub-core/term/arm/cros.c
> @@ -30,7 +30,7 @@
>  #include <grub/fdtbus.h>
>  #include <grub/arm/cros_ec.h>
>  
> -struct grub_ps2_state ps2_state;
> +static struct grub_ps2_state ps2_state;
>  
>  struct grub_cros_ec_keyscan old_scan;
>  
> diff --git a/grub-core/term/arm/pl050.c b/grub-core/term/arm/pl050.c
> index e4cda3056..b082243b0 100644
> --- a/grub-core/term/arm/pl050.c
> +++ b/grub-core/term/arm/pl050.c
> @@ -29,7 +29,7 @@
>  
>  static volatile grub_uint32_t *pl050_regs;
>  
> -struct grub_ps2_state ps2_state;
> +static struct grub_ps2_state ps2_state;
>  
>  static void
>  keyboard_controller_wait_until_ready (void)


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

* Re: [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure
  2020-12-03  6:15 ` Glenn Washburn
@ 2020-12-03 13:47   ` Glenn Washburn
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Washburn @ 2020-12-03 13:47 UTC (permalink / raw)
  To: grub-devel; +Cc: development, Daniel Kiper

On Thu, 3 Dec 2020 00:15:27 -0600
Glenn Washburn <development@efficientek.com> wrote:

> Here is a log file showing the build failure.
> 
> https://gitlab.com/grub2-testing/grub/-/jobs/885372725/raw

Accidentally deleted this pipeline. Here's another log with the same
error.

https://gitlab.com/grub2-testing/grub/-/jobs/888562636/raw

> On Thu,  3 Dec 2020 00:10:26 -0600
> Glenn Washburn <development@efficientek.com> wrote:
> 
> > This appears to be a new issue surfaced by switching from gcc 9.3.0
> > to 10.1.0 cross compiling toolchain. When linking these two object
> > files together, there is an error generated: "multiple definition of
> > `ps2_state'". This only appears to be an issue when
> > --target=arm-linux-gnueabi and --with-platform=coreboot. There's no
> > need for these structs to have global as opposed to file scope, so
> > declaring them as static fixes this issue.
> > 
> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > ---
> >  grub-core/term/arm/cros.c  | 2 +-
> >  grub-core/term/arm/pl050.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/grub-core/term/arm/cros.c b/grub-core/term/arm/cros.c
> > index 1ff9f8ccf..a17e49c32 100644
> > --- a/grub-core/term/arm/cros.c
> > +++ b/grub-core/term/arm/cros.c
> > @@ -30,7 +30,7 @@
> >  #include <grub/fdtbus.h>
> >  #include <grub/arm/cros_ec.h>
> >  
> > -struct grub_ps2_state ps2_state;
> > +static struct grub_ps2_state ps2_state;
> >  
> >  struct grub_cros_ec_keyscan old_scan;
> >  
> > diff --git a/grub-core/term/arm/pl050.c b/grub-core/term/arm/pl050.c
> > index e4cda3056..b082243b0 100644
> > --- a/grub-core/term/arm/pl050.c
> > +++ b/grub-core/term/arm/pl050.c
> > @@ -29,7 +29,7 @@
> >  
> >  static volatile grub_uint32_t *pl050_regs;
> >  
> > -struct grub_ps2_state ps2_state;
> > +static struct grub_ps2_state ps2_state;
> >  
> >  static void
> >  keyboard_controller_wait_until_ready (void)


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

* Re: [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure
  2020-12-03  6:10 [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure Glenn Washburn
  2020-12-03  6:15 ` Glenn Washburn
@ 2020-12-04 12:30 ` Daniel Kiper
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2020-12-04 12:30 UTC (permalink / raw)
  To: Glenn Washburn; +Cc: grub-devel

On Thu, Dec 03, 2020 at 12:10:26AM -0600, Glenn Washburn wrote:
> This appears to be a new issue surfaced by switching from gcc 9.3.0 to
> 10.1.0 cross compiling toolchain. When linking these two object files
> together, there is an error generated: "multiple definition of `ps2_state'".
> This only appears to be an issue when --target=arm-linux-gnueabi and
> --with-platform=coreboot. There's no need for these structs to have global
> as opposed to file scope, so declaring them as static fixes this issue.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
>  grub-core/term/arm/cros.c  | 2 +-
>  grub-core/term/arm/pl050.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

The same patch is in this [1] patch series. I will add your SOB there
and merge the patches into master next week.

Daniel

[1] https://lists.gnu.org/archive/html/grub-devel/2020-12/msg00044.html


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

end of thread, other threads:[~2020-12-04 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-03  6:10 [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure Glenn Washburn
2020-12-03  6:15 ` Glenn Washburn
2020-12-03 13:47   ` Glenn Washburn
2020-12-04 12:30 ` Daniel Kiper

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.