0001-Support-architectures-with-non-empty-__USER_LABEL_PR.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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__
  5. On some architectures (like Blackfin), a C symbol does not directly
  6. match with assembly symbols. The C symbol references are in fact all
  7. prefixed by a so-called "user label prefix". So when a symbol defined
  8. in an assembly file needs to be referenced from C, this symbol should
  9. be prefixed by the "user label prefix".
  10. This commit updates dtddata.S to take into account
  11. __USER_LABEL_PREFIX__ when it exists.
  12. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  13. ---
  14. src/dtddata.S | 19 +++++++++++++------
  15. 1 file changed, 13 insertions(+), 6 deletions(-)
  16. diff --git a/src/dtddata.S b/src/dtddata.S
  17. index ce51133..ad2a4db 100644
  18. --- a/src/dtddata.S
  19. +++ b/src/dtddata.S
  20. @@ -30,17 +30,24 @@
  21. /* from: http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967#comment-348129 */
  22. +#ifdef __USER_LABEL_PREFIX__
  23. +#define CONCAT1(a, b) CONCAT2(a, b)
  24. +#define CONCAT2(a, b) a ## b
  25. +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
  26. +#else
  27. +#endif
  28. +
  29. .macro binfile name file
  30. .p2align 2
  31. - .globl \name\()_begin
  32. -\name\()_begin:
  33. + .globl SYM(\name\()_begin)
  34. +SYM(\name\()_begin):
  35. .incbin "\file"
  36. -\name\()_end:
  37. +SYM(\name\()_end):
  38. .byte 0
  39. .p2align 2
  40. - .globl \name\()_len
  41. -\name\()_len:
  42. - .int (\name\()_end - \name\()_begin)
  43. + .globl SYM(\name\()_len)
  44. +SYM(\name\()_len):
  45. + .int (SYM(\name\()_end) - SYM(\name\()_begin))
  46. .endm
  47. .section .rodata
  48. --
  49. 2.7.4