Skip to content

Commit ae682c2

Browse files
committed
uboot-odroid-goa: Build fixes
Also sent upstream: * hardkernel/u-boot#66 * hardkernel/u-boot#65
1 parent d9d163b commit ae682c2

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From e5e701c2b8470de044c5c71d2a54ecfc72680d59 Mon Sep 17 00:00:00 2001
2+
From: Rasmus Villemoes <[email protected]>
3+
Date: Wed, 19 Sep 2018 11:35:56 +0900
4+
Subject: [PATCH] Kbuild: fix # escaping in .cmd files for future Make
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
[ commit 9564a8cf422d7b58f6e857e3546d346fa970191e in Linux ]
10+
11+
I tried building using a freshly built Make (4.2.1-69-g8a731d1), but
12+
already the objtool build broke with
13+
14+
orc_dump.c: In function ‘orc_dump’:
15+
orc_dump.c:106:2: error: ‘elf_getshnum’ is deprecated [-Werror=deprecated-declarations]
16+
if (elf_getshdrnum(elf, &nr_sections)) {
17+
18+
Turns out that with that new Make, the backslash was not removed, so cpp
19+
didn't see a #include directive, grep found nothing, and
20+
-DLIBELF_USE_DEPRECATED was wrongly put in CFLAGS.
21+
22+
Now, that new Make behaviour is documented in their NEWS file:
23+
24+
* WARNING: Backward-incompatibility!
25+
Number signs (#) appearing inside a macro reference or function invocation
26+
no longer introduce comments and should not be escaped with backslashes:
27+
thus a call such as:
28+
foo := $(shell echo '#')
29+
is legal. Previously the number sign needed to be escaped, for example:
30+
foo := $(shell echo '\#')
31+
Now this latter will resolve to "\#". If you want to write makefiles
32+
portable to both versions, assign the number sign to a variable:
33+
C := \#
34+
foo := $(shell echo '$C')
35+
This was claimed to be fixed in 3.81, but wasn't, for some reason.
36+
To detect this change search for 'nocomment' in the .FEATURES variable.
37+
38+
This also fixes up the two make-cmd instances to replace # with $(pound)
39+
rather than with \#. There might very well be other places that need
40+
similar fixup in preparation for whatever future Make release contains
41+
the above change, but at least this builds an x86_64 defconfig with the
42+
new make.
43+
44+
Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
45+
Cc: Randy Dunlap <[email protected]>
46+
Signed-off-by: Rasmus Villemoes <[email protected]>
47+
Signed-off-by: Masahiro Yamada <[email protected]>
48+
---
49+
scripts/Kbuild.include | 5 +++--
50+
1 file changed, 3 insertions(+), 2 deletions(-)
51+
52+
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
53+
index 2c7918ad37..13ebddda65 100644
54+
--- a/scripts/Kbuild.include
55+
+++ b/scripts/Kbuild.include
56+
@@ -7,6 +7,7 @@ quote := "
57+
squote := '
58+
empty :=
59+
space := $(empty) $(empty)
60+
+pound := \#
61+
62+
###
63+
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
64+
@@ -242,11 +243,11 @@ endif
65+
66+
# Replace >$< with >$$< to preserve $ when reloading the .cmd file
67+
# (needed for make)
68+
-# Replace >#< with >\#< to avoid starting a comment in the .cmd file
69+
+# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file
70+
# (needed for make)
71+
# Replace >'< with >'\''< to be able to enclose the whole string in '...'
72+
# (needed for the shell)
73+
-make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
74+
+make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
75+
76+
# Find any prerequisites that is newer than target or that does not exist.
77+
# PHONY targets skipped in both cases.
78+
--
79+
2.27.0
80+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 0c544115379ed77c1843a194e26960e5b8f3d369 Mon Sep 17 00:00:00 2001
2+
From: Masahiro Yamada <[email protected]>
3+
Date: Wed, 19 Sep 2018 11:35:57 +0900
4+
Subject: [PATCH] kbuild: fix # escaping in appending U-Boot own DT
5+
6+
The escape sequence '\#' does not work for the latest GNU Make from
7+
the git tree.
8+
9+
Replace it with $(pound) as Linux did.
10+
11+
Signed-off-by: Masahiro Yamada <[email protected]>
12+
---
13+
scripts/Makefile.lib | 2 +-
14+
1 file changed, 1 insertion(+), 1 deletion(-)
15+
16+
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
17+
index f8c3fff1d1..4dceb6d1b3 100644
18+
--- a/scripts/Makefile.lib
19+
+++ b/scripts/Makefile.lib
20+
@@ -299,7 +299,7 @@ quiet_cmd_dtc = DTC $@
21+
# Modified for U-Boot
22+
# Bring in any U-Boot-specific include at the end of the file
23+
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
24+
- (cat $<; $(if $(u_boot_dtsi),echo '\#include "$(u_boot_dtsi)"')) > $(pre-tmp); \
25+
+ (cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \
26+
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
27+
$(DTC) -O dtb -o $@ -b 0 \
28+
-i $(dir $<) $(DTC_FLAGS) \
29+
--
30+
2.27.0
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
From d988ec14978819bc2e0662fd9f853f52aedce498 Mon Sep 17 00:00:00 2001
2+
From: Dirk Mueller <[email protected]>
3+
Date: Tue, 14 Jan 2020 18:53:41 +0100
4+
Subject: [PATCH] scripts/dtc: Remove redundant YYLOC global declaration
5+
6+
commit e33a814e772cdc36436c8c188d8c42d019fda639 upstream.
7+
8+
gcc 10 will default to -fno-common, which causes this error at link
9+
time:
10+
11+
(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
12+
13+
This is because both dtc-lexer as well as dtc-parser define the same
14+
global symbol yyloc. Before with -fcommon those were merged into one
15+
defintion. The proper solution would be to to mark this as "extern",
16+
however that leads to:
17+
18+
dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
19+
26 | extern YYLTYPE yylloc;
20+
| ^~~~~~
21+
In file included from dtc-lexer.l:24:
22+
dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
23+
127 | extern YYLTYPE yylloc;
24+
| ^~~~~~
25+
cc1: all warnings being treated as errors
26+
27+
which means the declaration is completely redundant and can just be
28+
dropped.
29+
30+
Signed-off-by: Dirk Mueller <[email protected]>
31+
Signed-off-by: David Gibson <[email protected]>
32+
[robh: cherry-pick from upstream]
33+
34+
Signed-off-by: Rob Herring <[email protected]>
35+
[nc: Also apply to dtc-lexer.lex.c_shipped due to a lack of
36+
e039139be8c2, where dtc-lexer.l started being used]
37+
Signed-off-by: Nathan Chancellor <[email protected]>
38+
Signed-off-by: Greg Kroah-Hartman <[email protected]>
39+
Change-Id: I7f299451e99aab09375883546e47505ec0937c26
40+
---
41+
scripts/dtc/dtc-lexer.l | 1 -
42+
scripts/dtc/dtc-lexer.lex.c_shipped | 1 -
43+
2 files changed, 2 deletions(-)
44+
45+
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
46+
index fd825ebba6..24af549977 100644
47+
--- a/scripts/dtc/dtc-lexer.l
48+
+++ b/scripts/dtc/dtc-lexer.l
49+
@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
50+
#include "srcpos.h"
51+
#include "dtc-parser.tab.h"
52+
53+
-YYLTYPE yylloc;
54+
extern bool treesource_error;
55+
56+
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
57+
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
58+
index 011bb9632f..79952cd3ca 100644
59+
--- a/scripts/dtc/dtc-lexer.lex.c_shipped
60+
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
61+
@@ -631,7 +631,6 @@ char *yytext;
62+
#include "srcpos.h"
63+
#include "dtc-parser.tab.h"
64+
65+
-YYLTYPE yylloc;
66+
extern bool treesource_error;
67+
68+
/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
69+
--
70+
2.27.0
71+

0 commit comments

Comments
 (0)