6abb151608121a99e948e44163a1be782a266927
[openwrt/staging/pepe2k.git] / package / boot / uboot-layerscape / patches / 010-fix_dtc_compilation_on_host_gcc10.patch
1 From e33a814e772cdc36436c8c188d8c42d019fda639 Mon Sep 17 00:00:00 2001
2 From: Dirk Mueller <dmueller@suse.com>
3 Date: Tue, 14 Jan 2020 18:53:41 +0100
4 Subject: [PATCH] scripts/dtc: Remove redundant YYLOC global declaration
5
6 gcc 10 will default to -fno-common, which causes this error at link
7 time:
8
9 (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
10
11 This is because both dtc-lexer as well as dtc-parser define the same
12 global symbol yyloc. Before with -fcommon those were merged into one
13 defintion. The proper solution would be to to mark this as "extern",
14 however that leads to:
15
16 dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
17 26 | extern YYLTYPE yylloc;
18 | ^~~~~~
19 In file included from dtc-lexer.l:24:
20 dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
21 127 | extern YYLTYPE yylloc;
22 | ^~~~~~
23 cc1: all warnings being treated as errors
24
25 which means the declaration is completely redundant and can just be
26 dropped.
27
28 Signed-off-by: Dirk Mueller <dmueller@suse.com>
29 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
30 [robh: cherry-pick from upstream]
31 Cc: stable@vger.kernel.org
32 Signed-off-by: Rob Herring <robh@kernel.org>
33 ---
34 scripts/dtc/dtc-lexer.l | 1 -
35 1 file changed, 1 deletion(-)
36
37 --- a/scripts/dtc/dtc-lexer.l
38 +++ b/scripts/dtc/dtc-lexer.l
39 @@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
40 #include "srcpos.h"
41 #include "dtc-parser.tab.h"
42
43 -YYLTYPE yylloc;
44 extern bool treesource_error;
45
46 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */