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