diff options
| author | Manoj Gupta <manojgupta@google.com> | 2017-10-02 20:56:49 +0000 |
|---|---|---|
| committer | Manoj Gupta <manojgupta@google.com> | 2017-10-02 20:56:49 +0000 |
| commit | e2ff2ba57d64a740095737866f0787e6f2c1e410 (patch) | |
| tree | d3f0b602fdee88beeef950bff4d685179af147f9 | |
| parent | 121125f20d3c6f13f27839c759a41913eb5f1d20 (diff) | |
| download | bcm5719-llvm-e2ff2ba57d64a740095737866f0787e6f2c1e410.tar.gz bcm5719-llvm-e2ff2ba57d64a740095737866f0787e6f2c1e410.zip | |
[builtins] ARM: Reland fix for assembling builtins in thumb state.
Summary:
clang does not assemble files in thumb mode unless .thumb declaration
is present. Add .thumb/.arm decl to _FUNCTION macros to ensure that
files are assembled correctly.
Also add a fix to ensure that armv7k-watchos can assemble the
aeabi_c{f|d}cmp.S files.
Fixes PR 34715.
Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, efriedma, t.p.northover, fjricci
Reviewed By: compnerd
Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D38390
llvm-svn: 314718
| -rw-r--r-- | compiler-rt/lib/builtins/arm/aeabi_cdcmp.S | 5 | ||||
| -rw-r--r-- | compiler-rt/lib/builtins/arm/aeabi_cfcmp.S | 5 | ||||
| -rw-r--r-- | compiler-rt/lib/builtins/assembly.h | 9 |
3 files changed, 15 insertions, 4 deletions
diff --git a/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S b/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S index b06f294e29e..87dd03dce94 100644 --- a/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S +++ b/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S @@ -46,9 +46,12 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cdcmpeq) pop {r0-r3, lr} // NaN has been ruled out, so __aeabi_cdcmple can't trap + // Use "it ne" + unconditional branch to guarantee a supported relocation if + // __aeabi_cdcmple is in a different section for some builds. + IT(ne) bne __aeabi_cdcmple -#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) +#if defined(USE_THUMB_2) mov ip, #APSR_C msr APSR_nzcvq, ip #else diff --git a/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S b/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S index 7bc84073f6f..c5fee6b6a08 100644 --- a/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S +++ b/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S @@ -46,9 +46,12 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmpeq) pop {r0-r3, lr} // NaN has been ruled out, so __aeabi_cfcmple can't trap + // Use "it ne" + unconditional branch to guarantee a supported relocation if + // __aeabi_cfcmple is in a different section for some builds. + IT(ne) bne __aeabi_cfcmple -#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) +#if defined(USE_THUMB_2) mov ip, #APSR_C msr APSR_nzcvq, ip #else diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h index 58116114ab0..3f5e59b2544 100644 --- a/compiler-rt/lib/builtins/assembly.h +++ b/compiler-rt/lib/builtins/assembly.h @@ -75,7 +75,7 @@ * - for '-mthumb -march=armv7' compiler defines '__thumb__' and '__thumb2__' */ #if defined(__thumb2__) || defined(__thumb__) -#define DEFINE_CODE_STATE .thumb +#define DEFINE_CODE_STATE .thumb SEPARATOR #define DECLARE_FUNC_ENCODING .thumb_func SEPARATOR #if defined(__thumb2__) #define USE_THUMB_2 @@ -89,7 +89,7 @@ #define ITE(cond) #endif // defined(__thumb__2) #else // !defined(__thumb2__) && !defined(__thumb__) -#define DEFINE_CODE_STATE .arm +#define DEFINE_CODE_STATE .arm SEPARATOR #define DECLARE_FUNC_ENCODING #define IT(cond) #define ITT(cond) @@ -132,6 +132,7 @@ #endif #else // !defined(__arm) #define DECLARE_FUNC_ENCODING +#define DEFINE_CODE_STATE #endif #define GLUE2(a, b) a##b @@ -146,6 +147,7 @@ #endif #define DEFINE_COMPILERRT_FUNCTION(name) \ + DEFINE_CODE_STATE \ FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ @@ -154,6 +156,7 @@ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_THUMB_FUNCTION(name) \ + DEFINE_CODE_STATE \ FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ @@ -162,6 +165,7 @@ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ + DEFINE_CODE_STATE \ FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ @@ -170,6 +174,7 @@ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \ + DEFINE_CODE_STATE \ .globl name SEPARATOR \ SYMBOL_IS_FUNC(name) SEPARATOR \ HIDDEN(name) SEPARATOR \ |

