diff options
| author | Khem Raj <raj.khem@gmail.com> | 2021-03-24 00:36:59 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2021-03-25 07:42:49 -0700 |
| commit | 404e8129c26ea5387a51248eebff1820db6f5015 (patch) | |
| tree | ad48dffa1fbe84f5305fc9032538acc04bde53f3 | |
| parent | 539e8d85f4eb359d24b052efc6d4f7a9858fdbce (diff) | |
| download | meta-clang-404e8129c26ea5387a51248eebff1820db6f5015.tar.gz | |
compiler-rt: Fix build on armv6
Fixes Issue #445
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | recipes-devtools/clang/clang/0030-compiler-rt-Use-mcr-based-barrier-on-armv6.patch | 74 | ||||
| -rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
2 files changed, 75 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0030-compiler-rt-Use-mcr-based-barrier-on-armv6.patch b/recipes-devtools/clang/clang/0030-compiler-rt-Use-mcr-based-barrier-on-armv6.patch new file mode 100644 index 0000000..458dbcc --- /dev/null +++ b/recipes-devtools/clang/clang/0030-compiler-rt-Use-mcr-based-barrier-on-armv6.patch | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | From 97123bf7bc7cc2a55c3dfb5006be5dd66c46d790 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 24 Mar 2021 00:32:09 -0700 | ||
| 4 | Subject: [PATCH] compiler-rt: Use mcr based barrier on armv6 | ||
| 5 | |||
| 6 | dsb is an armv7 instruction and wont work when we are building for armv6. | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | compiler-rt/lib/builtins/arm/sync-ops.h | 8 ++++---- | ||
| 12 | compiler-rt/lib/builtins/assembly.h | 8 ++++++++ | ||
| 13 | 2 files changed, 12 insertions(+), 4 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h | ||
| 16 | index c9623249e5d2..7a26170741ad 100644 | ||
| 17 | --- a/compiler-rt/lib/builtins/arm/sync-ops.h | ||
| 18 | +++ b/compiler-rt/lib/builtins/arm/sync-ops.h | ||
| 19 | @@ -19,14 +19,14 @@ | ||
| 20 | .thumb; \ | ||
| 21 | .syntax unified; \ | ||
| 22 | DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ | ||
| 23 | - dmb; \ | ||
| 24 | + DMB; \ | ||
| 25 | mov r12, r0; \ | ||
| 26 | LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \ | ||
| 27 | op(r2, r0, r1); \ | ||
| 28 | strex r3, r2, [r12]; \ | ||
| 29 | cmp r3, #0; \ | ||
| 30 | bne LOCAL_LABEL(tryatomic_##op); \ | ||
| 31 | - dmb; \ | ||
| 32 | + DMB; \ | ||
| 33 | bx lr | ||
| 34 | |||
| 35 | #define SYNC_OP_8(op) \ | ||
| 36 | @@ -35,14 +35,14 @@ | ||
| 37 | .syntax unified; \ | ||
| 38 | DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ | ||
| 39 | push {r4, r5, r6, lr}; \ | ||
| 40 | - dmb; \ | ||
| 41 | + DMB; \ | ||
| 42 | mov r12, r0; \ | ||
| 43 | LOCAL_LABEL(tryatomic_##op) : ldrexd r0, r1, [r12]; \ | ||
| 44 | op(r4, r5, r0, r1, r2, r3); \ | ||
| 45 | strexd r6, r4, r5, [r12]; \ | ||
| 46 | cmp r6, #0; \ | ||
| 47 | bne LOCAL_LABEL(tryatomic_##op); \ | ||
| 48 | - dmb; \ | ||
| 49 | + DMB; \ | ||
| 50 | pop { r4, r5, r6, pc } | ||
| 51 | |||
| 52 | #define MINMAX_4(rD, rN, rM, cmp_kind) \ | ||
| 53 | diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h | ||
| 54 | index f6ce6a9fccff..5c6cd9376ac4 100644 | ||
| 55 | --- a/compiler-rt/lib/builtins/assembly.h | ||
| 56 | +++ b/compiler-rt/lib/builtins/assembly.h | ||
| 57 | @@ -181,6 +181,14 @@ | ||
| 58 | JMP(ip) | ||
| 59 | #endif | ||
| 60 | |||
| 61 | +#if __ARM_ARCH >= 7 | ||
| 62 | +#define DMB dmb | ||
| 63 | +#elif __ARM_ARCH >= 6 | ||
| 64 | +#define DMB mcr p15, #0, r0, c7, c10, #5 | ||
| 65 | +#else | ||
| 66 | +#error Only use this with ARMv6+ | ||
| 67 | +#endif | ||
| 68 | + | ||
| 69 | #if defined(USE_THUMB_2) | ||
| 70 | #define WIDE(op) op.w | ||
| 71 | #else | ||
| 72 | -- | ||
| 73 | 2.31.0 | ||
| 74 | |||
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index b6af90c..9de7674 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
| @@ -38,6 +38,7 @@ SRC_URI = "\ | |||
| 38 | file://0027-compiler-rt-Include-stddef.h.patch \ | 38 | file://0027-compiler-rt-Include-stddef.h.patch \ |
| 39 | file://0028-llvm-Do-not-use-find_library-for-ncurses.patch \ | 39 | file://0028-llvm-Do-not-use-find_library-for-ncurses.patch \ |
| 40 | file://0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch \ | 40 | file://0029-llvm-Recognize-yoe-and-poky-as-OE-distro.patch \ |
| 41 | file://0030-compiler-rt-Use-mcr-based-barrier-on-armv6.patch \ | ||
| 41 | " | 42 | " |
| 42 | # Fallback to no-PIE if not set | 43 | # Fallback to no-PIE if not set |
| 43 | GCCPIE ??= "" | 44 | GCCPIE ??= "" |
