1 From 0a337328411d5b3f37b169a83b6fee3f1726130f Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Thu, 26 May 2016 15:57:33 +0200
4 Subject: [PATCH] Support architectures with non-empty __USER_LABEL_PREFIX__
6 On some architectures (like Blackfin), a C symbol does not directly
7 match with assembly symbols. The C symbol references are in fact all
8 prefixed by a so-called "user label prefix". So when a symbol defined
9 in an assembly file needs to be referenced from C, this symbol should
10 be prefixed by the "user label prefix".
12 This commit updates dtddata.S to take into account
13 __USER_LABEL_PREFIX__ when it exists.
15 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17 src/dtddata.S | 19 +++++++++++++------
18 1 file changed, 13 insertions(+), 6 deletions(-)
20 diff --git a/src/dtddata.S b/src/dtddata.S
21 index ce51133..ad2a4db 100644
26 /* from: http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967#comment-348129 */
28 +#ifdef __USER_LABEL_PREFIX__
29 +#define CONCAT1(a, b) CONCAT2(a, b)
30 +#define CONCAT2(a, b) a ## b
31 +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
35 .macro binfile name file
37 - .globl \name\()_begin
39 + .globl SYM(\name\()_begin)
48 - .int (\name\()_end - \name\()_begin)
49 + .globl SYM(\name\()_len)
51 + .int (SYM(\name\()_end) - SYM(\name\()_begin))