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