Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] pdbg: add patch fixing the build on Blackfin
@ 2017-11-26 15:29 Thomas Petazzoni
  2017-11-27  8:48 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Petazzoni @ 2017-11-26 15:29 UTC (permalink / raw)
  To: buildroot

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>
---
 ...fix-to-build-on-architecture-with-non-emp.patch | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch

diff --git a/package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch b/package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch
new file mode 100644
index 0000000000..15c0eef611
--- /dev/null
+++ b/package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch
@@ -0,0 +1,63 @@
+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
+
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] pdbg: add patch fixing the build on Blackfin
  2017-11-26 15:29 [Buildroot] [PATCH] pdbg: add patch fixing the build on Blackfin Thomas Petazzoni
@ 2017-11-27  8:48 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2017-11-27  8:48 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 26 Nov 2017 16:29:47 +0100, Thomas Petazzoni wrote:
> 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>
> ---
>  ...fix-to-build-on-architecture-with-non-emp.patch | 63 ++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 package/pdbg/0001-template.S-fix-to-build-on-architecture-with-non-emp.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-27  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-26 15:29 [Buildroot] [PATCH] pdbg: add patch fixing the build on Blackfin Thomas Petazzoni
2017-11-27  8:48 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox