uboot-mvebu: Fix build with GCC-10 as host compiler
authorSven Eckelmann <sven@narfation.org>
Sat, 11 Sep 2021 19:03:34 +0000 (21:03 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 13 Sep 2021 11:06:02 +0000 (13:06 +0200)
The package uses the host compiler to build the dtc binary. With gcc-10,
the option -fno-common is now the default behavior. Thus multiple
definitions of the same variable are now forbidden and results in following
error during linking:

  HOSTLD  scripts/dtc/dtc
  /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
  collect2: error: ld returned 1 exit status

The easiest workaround is to add the upstream commit 018921ee79d3 ("Remove
redundant YYLOC global declaration").

Signed-off-by: Sven Eckelmann <sven@narfation.org>
package/boot/uboot-mvebu/patches/001-yylloc-redefinition.patch [new file with mode: 0644]

diff --git a/package/boot/uboot-mvebu/patches/001-yylloc-redefinition.patch b/package/boot/uboot-mvebu/patches/001-yylloc-redefinition.patch
new file mode 100644 (file)
index 0000000..f334995
--- /dev/null
@@ -0,0 +1,33 @@
+From 018921ee79d3f30893614b3b2b63b588d8544f73 Mon Sep 17 00:00:00 2001
+From: Peter Robinson <pbrobinson@gmail.com>
+Date: Thu, 30 Jan 2020 09:37:15 +0000
+Subject: [PATCH] Remove redundant YYLOC global declaration
+
+Same as the upstream fix for building dtc with gcc 10.
+
+Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
+Origin: backport, https://github.com/u-boot/u-boot/commit/018921ee79d3f30893614b3b2b63b588d8544f73
+---
+ scripts/dtc/dtc-lexer.l | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/scripts/dtc/dtc-lexer.l
++++ b/scripts/dtc/dtc-lexer.l
+@@ -38,7 +38,6 @@ LINECOMMENT  "//".*\n
+ #include "srcpos.h"
+ #include "dtc-parser.tab.h"
+-YYLTYPE yylloc;
+ extern bool treesource_error;
+ /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
+--- a/scripts/dtc/dtc-lexer.lex.c_shipped
++++ b/scripts/dtc/dtc-lexer.lex.c_shipped
+@@ -631,7 +631,6 @@ char *yytext;
+ #include "srcpos.h"
+ #include "dtc-parser.tab.h"
+-YYLTYPE yylloc;
+ extern bool treesource_error;
+ /* CAUTION: this will stop working if we ever use yyless() or yyunput() */