Skip to contentSkip to conversation

board/intel/galileo: fix build failure with host gcc 10

PATCH Applied Giulio Benetti 3 participants 5 messages Feb 2, 2022 – Feb 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/intel/galileo: fix build failure with host gcc 10

Building galileo_defconfig throws error:

```
/usr/bin/ld: arch/x86/tools/relocs_64.o:(.bss+0x0): multiple definition of `per_cpu_load_addr'; arch/x86/tools/relocs_32.o:(.bss+0x0): first defined here
```

To fix this let's add an upstreamed patch[1] and add BR2_GLOBAL_PATCH_DIR to galileo_defconfig to point to where patch is.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eeeda4cd06e828b331b15741a204ff9f5874d28d.patch

Fixes:
https://gitlab.com/ymorin/buildroot/-/jobs/2035821039

---
 ...relocs-Make-per_cpu_load_addr-static.patch | 39 +++++++++++++++++++
 configs/galileo_defconfig                     |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch
board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch new file +39 -0
new file mode 100644
index 0000000000..1d206cc6d1
@@ -0,0 +1,39 @@
+From eeeda4cd06e828b331b15741a204ff9f5874d28d Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <[email protected]>
+Date: Wed, 24 Sep 2014 13:30:12 +0100
+Subject: [PATCH] x86/relocs: Make per_cpu_load_addr static
+
+per_cpu_load_addr is only used for 64-bit relocations, but is
+declared in both configurations of relocs.c - with different
+types.  This has undefined behaviour in general.  GNU ld is
+documented to use the larger size in this case, but other tools
+may differ and some warn about this.
+
+References: https://bugs.debian.org/748577
+Reported-by: Michael Tautschnig <[email protected]>
+Signed-off-by: Ben Hutchings <[email protected]>
+Cc: [email protected]
+Cc: Linus Torvalds <[email protected]>
+Link: http://lkml.kernel.org/r/[email protected]
+Signed-off-by: Ingo Molnar <[email protected]>
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ arch/x86/tools/relocs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
+index bbb1d2259ecf..a5efb21d5228 100644
+--- a/arch/x86/tools/relocs.c
++++ b/arch/x86/tools/relocs.c
+@@ -695,7 +695,7 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
+  *
+  */
+ static int per_cpu_shndx	= -1;
+-Elf_Addr per_cpu_load_addr;
++static Elf_Addr per_cpu_load_addr;
+ 
+ static void percpu_init(void)
+ {
+-- 
+2.25.1
+
configs/galileo_defconfig +1 -0
index 03ca23f414..a8fd0a6dcc 100644
@@ -1,4 +1,5 @@
 BR2_x86_x1000=y
+BR2_GLOBAL_PATCH_DIR=board/intel/galileo/patches
 # Needed for TARGET_GRUB2
 BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
 # Linux headers same as kernel, a 3.14 series
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 8 lines · Giulio Benetti

Building galileo_defconfig throws error:

```
/usr/bin/ld: arch/x86/tools/relocs_64.o:(.bss+0x0): multiple definition of `per_cpu_load_addr'; arch/x86/tools/relocs_32.o:(.bss+0x0): first defined here
```

To fix this let's add an upstreamed patch[1] and add BR2_GLOBAL_PATCH_DIR to galileo_defconfig to point to where patch is.

Quoted 6 lines

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eeeda4cd06e828b331b15741a204ff9f5874d28d.patch

Fixes:
https://gitlab.com/ymorin/buildroot/-/jobs/2035821039

You can't imagine how much joy it gives me to see a patch from 2014 applied
here...

Applied to master, thanks.

Regards,
Arnout

Quoted 56 lines
---
  ...relocs-Make-per_cpu_load_addr-static.patch | 39 +++++++++++++++++++
  configs/galileo_defconfig                     |  1 +
  2 files changed, 40 insertions(+)

create mode 100644 board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch

board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch new file +39 -0
new file mode 100644
index 0000000000..1d206cc6d1
@@ -0,0 +1,39 @@
+From eeeda4cd06e828b331b15741a204ff9f5874d28d Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <[email protected]>
+Date: Wed, 24 Sep 2014 13:30:12 +0100
+Subject: [PATCH] x86/relocs: Make per_cpu_load_addr static
+
+per_cpu_load_addr is only used for 64-bit relocations, but is
+declared in both configurations of relocs.c - with different
+types.  This has undefined behaviour in general.  GNU ld is
+documented to use the larger size in this case, but other tools
+may differ and some warn about this.
+
+References: https://bugs.debian.org/748577
+Reported-by: Michael Tautschnig <[email protected]>
+Signed-off-by: Ben Hutchings <[email protected]>
+Cc: [email protected]
+Cc: Linus Torvalds <[email protected]>
+Link: http://lkml.kernel.org/r/[email protected]
+Signed-off-by: Ingo Molnar <[email protected]>
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ arch/x86/tools/relocs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
+index bbb1d2259ecf..a5efb21d5228 100644
+--- a/arch/x86/tools/relocs.c
++++ b/arch/x86/tools/relocs.c
+@@ -695,7 +695,7 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
+  *
+  */
+ static int per_cpu_shndx	= -1;
+-Elf_Addr per_cpu_load_addr;
++static Elf_Addr per_cpu_load_addr;
+
+ static void percpu_init(void)
+ {
+--
+2.25.1
+
configs/galileo_defconfig +0 -0
index 03ca23f414..a8fd0a6dcc 100644

configs/galileo_defconfig line 5

Quoted 5 lines
configs/galileo_defconfig +1 -0
@@ -1,4 +1,5 @@
  BR2_x86_x1000=y
+BR2_GLOBAL_PATCH_DIR=board/intel/galileo/patches
  # Needed for TARGET_GRUB2
  BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
  # Linux headers same as kernel, a 3.14 series

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Nicolas,

sorry for html but I’m mobile.

My patch for fixing the build failure for Galileo has been upstream, but Linux version is very old,
I’ve added a local patch from 2014 as pointed Arnout below.
I don’t have a Galileo board and you are the maintainer, can you please update uboot and Linux versions and send a patch for that after testing please?

Thank you!
—-
Giulio Benetti
Benetti Engineering sas

Quoted 80 lines

Il giorno 13 feb 2022, alle ore 12:46, Arnout Vandecappelle <[email protected]> ha scritto:



Quoted 11 lines · Giulio Benetti

Building galileo_defconfig throws error:

```
/usr/bin/ld: arch/x86/tools/relocs_64.o:(.bss+0x0): multiple definition of `per_cpu_load_addr'; arch/x86/tools/relocs_32.o:(.bss+0x0): first defined here
```

To fix this let's add an upstreamed patch[1] and add BR2_GLOBAL_PATCH_DIR
to galileo_defconfig to point to where patch is.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eeeda4cd06e828b331b15741a204ff9f5874d28d.patch
Fixes:
https://gitlab.com/ymorin/buildroot/-/jobs/2035821039

You can't imagine how much joy it gives me to see a patch from 2014 applied here...

Applied to master, thanks.

Regards,
Arnout

Quoted 56 lines
---
 ...relocs-Make-per_cpu_load_addr-static.patch | 39 +++++++++++++++++++
 configs/galileo_defconfig                     |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch
board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch new file +39 -0
new file mode 100644
index 0000000000..1d206cc6d1
@@ -0,0 +1,39 @@
+From eeeda4cd06e828b331b15741a204ff9f5874d28d Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <[email protected]>
+Date: Wed, 24 Sep 2014 13:30:12 +0100
+Subject: [PATCH] x86/relocs: Make per_cpu_load_addr static
+
+per_cpu_load_addr is only used for 64-bit relocations, but is
+declared in both configurations of relocs.c - with different
+types.  This has undefined behaviour in general.  GNU ld is
+documented to use the larger size in this case, but other tools
+may differ and some warn about this.
+
+References: https://bugs.debian.org/748577
+Reported-by: Michael Tautschnig <[email protected]>
+Signed-off-by: Ben Hutchings <[email protected]>
+Cc: [email protected]
+Cc: Linus Torvalds <[email protected]>
+Link: http://lkml.kernel.org/r/[email protected]
+Signed-off-by: Ingo Molnar <[email protected]>
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ arch/x86/tools/relocs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
+index bbb1d2259ecf..a5efb21d5228 100644
+--- a/arch/x86/tools/relocs.c
++++ b/arch/x86/tools/relocs.c
+@@ -695,7 +695,7 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
+  *
+  */
+ static int per_cpu_shndx    = -1;
+-Elf_Addr per_cpu_load_addr;
++static Elf_Addr per_cpu_load_addr;
+
+ static void percpu_init(void)
+ {
+--
+2.25.1
+
configs/galileo_defconfig +0 -0
index 03ca23f414..a8fd0a6dcc 100644
@@ -1,4 +1,5 @@
 BR2_x86_x1000=y
Quoted 8 lines

configs/galileo_defconfig line 5

Quoted 4 lines
configs/galileo_defconfig +1 -0
+BR2_GLOBAL_PATCH_DIR=board/intel/galileo/patches
 # Needed for TARGET_GRUB2
 BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
 # Linux headers same as kernel, a 3.14 series

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hi All,

Nicholas will take care about bumping uboot and Linux in a couple of weeks. He’s written me privately.

Best regards
Giulio

Quoted 104 lines

Il giorno 13 feb 2022, alle ore 13:56, Giulio Benetti <[email protected]> ha scritto:

Hi Nicolas,

sorry for html but I’m mobile.

My patch for fixing the build failure for Galileo has been upstream, but Linux version is very old,
I’ve added a local patch from 2014 as pointed Arnout below.
I don’t have a Galileo board and you are the maintainer, can you please update uboot and Linux versions and send a patch for that after testing please?

Thank you!
—-
Giulio Benetti
Benetti Engineering sas

Quoted 80 lines

Il giorno 13 feb 2022, alle ore 12:46, Arnout Vandecappelle <[email protected]> ha scritto:



Quoted 11 lines
Quoted 1 line · Giulio Benetti

Building galileo_defconfig throws error:

```
/usr/bin/ld: arch/x86/tools/relocs_64.o:(.bss+0x0): multiple definition of `per_cpu_load_addr'; arch/x86/tools/relocs_32.o:(.bss+0x0): first defined here
```

To fix this let's add an upstreamed patch[1] and add BR2_GLOBAL_PATCH_DIR
to galileo_defconfig to point to where patch is.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eeeda4cd06e828b331b15741a204ff9f5874d28d.patch
Fixes:
https://gitlab.com/ymorin/buildroot/-/jobs/2035821039

You can't imagine how much joy it gives me to see a patch from 2014 applied here...

Applied to master, thanks.

Regards,
Arnout

Quoted 56 lines

---
...relocs-Make-per_cpu_load_addr-static.patch | 39 +++++++++++++++++++
configs/galileo_defconfig | 1 +

2 files changed, 40 insertions(+)

create mode 100644 board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch

board/intel/galileo/patches/linux/0001-x86-relocs-Make-per_cpu_load_addr-static.patch new file +39 -0
new file mode 100644
index 0000000000..1d206cc6d1
@@ -0,0 +1,39 @@
+From eeeda4cd06e828b331b15741a204ff9f5874d28d Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <[email protected]>
+Date: Wed, 24 Sep 2014 13:30:12 +0100
+Subject: [PATCH] x86/relocs: Make per_cpu_load_addr static
+
+per_cpu_load_addr is only used for 64-bit relocations, but is
+declared in both configurations of relocs.c - with different
+types.  This has undefined behaviour in general.  GNU ld is
+documented to use the larger size in this case, but other tools
+may differ and some warn about this.
+
+References: https://bugs.debian.org/748577
+Reported-by: Michael Tautschnig <[email protected]>
+Signed-off-by: Ben Hutchings <[email protected]>
+Cc: [email protected]
+Cc: Linus Torvalds <[email protected]>
+Link: http://lkml.kernel.org/r/[email protected]
+Signed-off-by: Ingo Molnar <[email protected]>
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ arch/x86/tools/relocs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
+index bbb1d2259ecf..a5efb21d5228 100644
+--- a/arch/x86/tools/relocs.c
++++ b/arch/x86/tools/relocs.c
+@@ -695,7 +695,7 @@ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
+  *
+  */
+ static int per_cpu_shndx    = -1;
+-Elf_Addr per_cpu_load_addr;
++static Elf_Addr per_cpu_load_addr;
+
+ static void percpu_init(void)
+ {
+--
+2.25.1
+
configs/galileo_defconfig +0 -0
index 03ca23f414..a8fd0a6dcc 100644
@@ -1,4 +1,5 @@

BR2_x86_x1000=y

Quoted 8 lines
Quoted 4 lines

+BR2_GLOBAL_PATCH_DIR=board/intel/galileo/patches
# Needed for TARGET_GRUB2
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
# Linux headers same as kernel, a 3.14 series

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Giulio Benetti
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

Building galileo_defconfig throws error:

```
/usr/bin/ld: arch/x86/tools/relocs_64.o:(.bss+0x0): multiple
definition of `per_cpu_load_addr';
arch/x86/tools/relocs_32.o:(.bss+0x0): first defined here
```

To fix this let's add an upstreamed patch[1] and add BR2_GLOBAL_PATCH_DIR to galileo_defconfig to point to where patch is.

Quoted 7 lines

[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eeeda4cd06e828b331b15741a204ff9f5874d28d.patch

Fixes:
https://gitlab.com/ymorin/buildroot/-/jobs/2035821039

Committed to 2021.02.x and 2021.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot