0032-compiler-rt-Do-not-force-thumb-mode-directive.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From d42554b552128fad6ffe80ee72b0f1b6dc2cbccd Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 11:01:27 +0800
  4. Subject: [PATCH 32/34] compiler-rt: Do not force thumb mode directive
  5. .thumb_func was not switching mode until [1]
  6. so it did not show up but now that .thumb_func (without argument) is
  7. switching mode, its causing build failures on armv6 ( rpi0 ) even when
  8. build is explicitly asking for this file to be built with -marm (ARM
  9. mode), therefore use DEFINE_COMPILERRT_FUNCTION macro to add function
  10. header which considers arch and mode from compiler cmdline to decide if
  11. the function is built using thumb mode or arm mode.
  12. [1] https://reviews.llvm.org/D101975
  13. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  14. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  15. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  16. ---
  17. compiler-rt/lib/builtins/arm/sync-ops.h | 6 ++----
  18. 1 file changed, 2 insertions(+), 4 deletions(-)
  19. diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h
  20. index 7a26170741ad..d914f9d3a109 100644
  21. --- a/compiler-rt/lib/builtins/arm/sync-ops.h
  22. +++ b/compiler-rt/lib/builtins/arm/sync-ops.h
  23. @@ -16,9 +16,8 @@
  24. #define SYNC_OP_4(op) \
  25. .p2align 2; \
  26. - .thumb; \
  27. .syntax unified; \
  28. - DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \
  29. + DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_##op) \
  30. DMB; \
  31. mov r12, r0; \
  32. LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \
  33. @@ -31,9 +30,8 @@
  34. #define SYNC_OP_8(op) \
  35. .p2align 2; \
  36. - .thumb; \
  37. .syntax unified; \
  38. - DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \
  39. + DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_##op) \
  40. push {r4, r5, r6, lr}; \
  41. DMB; \
  42. mov r12, r0; \
  43. --
  44. 2.33.1