]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch
pdbg: add patch fixing the build on Blackfin
[coffee/buildroot.git] / package / pdbg / 0001-template.S-fix-to-build-on-architecture-with-non-emp.patch
1 From 50ae93273376ede704012030009c29bd58d6a569 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Sun, 26 Nov 2017 16:22:25 +0100
4 Subject: [PATCH] template.S: fix to build on architecture with non-empty
5  __USER_LABEL_PREFIX__
6
7 Blackfin has a non-empty __USER_LABEL_PREFIX__, which means that a
8 symbol called "foo" in C must be named "_foo" in assembler.
9
10 Interestingly, it seems like "$(CC) -xassembler - -c" doesn't pass the
11 input source file through the C preprocessor, so we do this
12 explicitly.
13
14 Submitted-upstream: https://github.com/open-power/pdbg/pull/26
15 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
16 ---
17  Makefile.am |  2 +-
18  template.S  | 22 +++++++++++++++-------
19  2 files changed, 16 insertions(+), 8 deletions(-)
20
21 diff --git a/Makefile.am b/Makefile.am
22 index 9d34bff..82e0856 100644
23 --- a/Makefile.am
24 +++ b/Makefile.am
25 @@ -62,4 +62,4 @@ p9z-fsi.dtb.o: p9z-fsi.dts p9-fsi.dtsi
26  %.dtb.o: %.dts
27         dtc -i$(dir $@) -I dts $< -O dtb > $@.tmp
28         symbol_prefix=`echo $@ | tr '.-' '_'` ; \
29 -       sed "s%SYMBOL_PREFIX%$${symbol_prefix}%g; s%FILENAME%$@.tmp%g" $(top_srcdir)/template.S | $(CC) -xassembler - -c -o $@
30 +       sed "s%SYMBOL_PREFIX%$${symbol_prefix}%g; s%FILENAME%$@.tmp%g" $(top_srcdir)/template.S | $(CPP) - | $(CC) -xassembler - -c -o $@
31 diff --git a/template.S b/template.S
32 index 2e6cbdb..1407a7c 100644
33 --- a/template.S
34 +++ b/template.S
35 @@ -1,10 +1,18 @@
36 +#ifdef __USER_LABEL_PREFIX__
37 +#define CONCAT1(a, b) CONCAT2(a, b)
38 +#define CONCAT2(a, b) a ## b
39 +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
40 +#else
41 +#define SYM(x) x
42 +#endif
43 +
44  .section .data
45 -_binary_SYMBOL_PREFIX_start:
46 +SYM(_binary_SYMBOL_PREFIX_start):
47  .incbin "FILENAME"
48  .align 4
49 -_binary_SYMBOL_PREFIX_end:
50 -_binary_SYMBOL_PREFIX_size:
51 -       .long   _binary_SYMBOL_PREFIX_end - _binary_SYMBOL_PREFIX_start
52 -.globl _binary_SYMBOL_PREFIX_start
53 -.globl _binary_SYMBOL_PREFIX_end
54 -.globl _binary_SYMBOL_PREFIX_size
55 +SYM(_binary_SYMBOL_PREFIX_end):
56 +SYM(_binary_SYMBOL_PREFIX_size):
57 +       .long   SYM(_binary_SYMBOL_PREFIX_end) - SYM(_binary_SYMBOL_PREFIX_start)
58 +.globl SYM(_binary_SYMBOL_PREFIX_start)
59 +.globl SYM(_binary_SYMBOL_PREFIX_end)
60 +.globl SYM(_binary_SYMBOL_PREFIX_size)
61 -- 
62 2.13.6
63