kumquat-buildroot/package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch
Thomas Petazzoni 3950f5412e pdbg: add patch fixing the build on Blackfin
This commit adds a patch to pdbg that fixes the build on the Blackfin
architecture. The build failure was due to the recently introduced
assembly code to embed the DTB into an object file. This code was not
taking into account the fact that Blackfin has a non-empty
__USER_LABEL_PREFIX__.

The patch has been submitted upstream.

Fixes:

  http://autobuild.buildroot.net/results/2bf6f56303453fd2ba7e86882168d406ded4cc80/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-11-26 16:25:09 +01:00

64 lines
2.2 KiB
Diff

From 50ae93273376ede704012030009c29bd58d6a569 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sun, 26 Nov 2017 16:22:25 +0100
Subject: [PATCH] template.S: fix to build on architecture with non-empty
__USER_LABEL_PREFIX__
Blackfin has a non-empty __USER_LABEL_PREFIX__, which means that a
symbol called "foo" in C must be named "_foo" in assembler.
Interestingly, it seems like "$(CC) -xassembler - -c" doesn't pass the
input source file through the C preprocessor, so we do this
explicitly.
Submitted-upstream: https://github.com/open-power/pdbg/pull/26
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile.am | 2 +-
template.S | 22 +++++++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 9d34bff..82e0856 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,4 +62,4 @@ p9z-fsi.dtb.o: p9z-fsi.dts p9-fsi.dtsi
%.dtb.o: %.dts
dtc -i$(dir $@) -I dts $< -O dtb > $@.tmp
symbol_prefix=`echo $@ | tr '.-' '_'` ; \
- sed "s%SYMBOL_PREFIX%$${symbol_prefix}%g; s%FILENAME%$@.tmp%g" $(top_srcdir)/template.S | $(CC) -xassembler - -c -o $@
+ sed "s%SYMBOL_PREFIX%$${symbol_prefix}%g; s%FILENAME%$@.tmp%g" $(top_srcdir)/template.S | $(CPP) - | $(CC) -xassembler - -c -o $@
diff --git a/template.S b/template.S
index 2e6cbdb..1407a7c 100644
--- a/template.S
+++ b/template.S
@@ -1,10 +1,18 @@
+#ifdef __USER_LABEL_PREFIX__
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+#else
+#define SYM(x) x
+#endif
+
.section .data
-_binary_SYMBOL_PREFIX_start:
+SYM(_binary_SYMBOL_PREFIX_start):
.incbin "FILENAME"
.align 4
-_binary_SYMBOL_PREFIX_end:
-_binary_SYMBOL_PREFIX_size:
- .long _binary_SYMBOL_PREFIX_end - _binary_SYMBOL_PREFIX_start
-.globl _binary_SYMBOL_PREFIX_start
-.globl _binary_SYMBOL_PREFIX_end
-.globl _binary_SYMBOL_PREFIX_size
+SYM(_binary_SYMBOL_PREFIX_end):
+SYM(_binary_SYMBOL_PREFIX_size):
+ .long SYM(_binary_SYMBOL_PREFIX_end) - SYM(_binary_SYMBOL_PREFIX_start)
+.globl SYM(_binary_SYMBOL_PREFIX_start)
+.globl SYM(_binary_SYMBOL_PREFIX_end)
+.globl SYM(_binary_SYMBOL_PREFIX_size)
--
2.13.6