Fix the armv7 thumb builtins on darwin

The arm builtins converted into thumb in r213481 are not working
on darwin. On apple platforms, .thumb_func directive is required
to generated correct symbols for thumb functions.

<rdar://problem/18523605>

llvm-svn: 219040
This commit is contained in:
Steven Wu 2014-10-04 00:18:59 +00:00
parent 09d00bb4d7
commit 84610ba9b3
12 changed files with 24 additions and 12 deletions

View File

@ -21,7 +21,7 @@
// Reverse all the bytes in a 64-bit integer.
//
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__bswapdi2)
DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapdi2)
#if __ARM_ARCH < 6
// before armv6 does not have "rev" instruction
// r2 = rev(r0)

View File

@ -21,7 +21,7 @@
// Reverse all the bytes in a 32-bit integer.
//
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapsi2)
#if __ARM_ARCH < 6
// before armv6 does not have "rev" instruction
eor r1, r0, r0, ror #16

View File

@ -21,7 +21,7 @@
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__clzdi2)
DEFINE_COMPILERRT_THUMB_FUNCTION(__clzdi2)
#ifdef __ARM_FEATURE_CLZ
#ifdef __ARMEB__
cmp r0, 0

View File

@ -20,7 +20,7 @@
#endif
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__clzsi2)
DEFINE_COMPILERRT_THUMB_FUNCTION(__clzsi2)
#ifdef __ARM_FEATURE_CLZ
clz r0, r0
JMP(lr)

View File

@ -32,7 +32,7 @@
@ value is the quotient, the remainder is placed in the variable.
.p2align 3
DEFINE_COMPILERRT_FUNCTION(__divmodsi4)
DEFINE_COMPILERRT_THUMB_FUNCTION(__divmodsi4)
#if __ARM_ARCH_EXT_IDIV__
tst r1, r1
beq LOCAL_LABEL(divzero)

View File

@ -33,7 +33,7 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_idiv, __divsi3)
@ int __divsi3(int divident, int divisor)
@ Calculate and return the quotient of the (signed) division.
DEFINE_COMPILERRT_FUNCTION(__divsi3)
DEFINE_COMPILERRT_THUMB_FUNCTION(__divsi3)
#if __ARM_ARCH_EXT_IDIV__
tst r1,r1
beq LOCAL_LABEL(divzero)

View File

@ -30,7 +30,7 @@
@ Calculate and return the remainder of the (signed) division.
.p2align 3
DEFINE_COMPILERRT_FUNCTION(__modsi3)
DEFINE_COMPILERRT_THUMB_FUNCTION(__modsi3)
#if __ARM_ARCH_EXT_IDIV__
tst r1, r1
beq LOCAL_LABEL(divzero)

View File

@ -19,7 +19,7 @@
.p2align 2 ; \
.thumb ; \
.syntax unified ; \
DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_ ## op) \
DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_ ## op) \
dmb ; \
mov r12, r0 ; \
LOCAL_LABEL(tryatomic_ ## op): \
@ -35,7 +35,7 @@
.p2align 2 ; \
.thumb ; \
.syntax unified ; \
DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_ ## op) \
DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_ ## op) \
push {r4, r5, r6, lr} ; \
dmb ; \
mov r12, r0 ; \

View File

@ -27,7 +27,7 @@
@ value is the quotient, the remainder is placed in the variable.
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__udivmodsi4)
DEFINE_COMPILERRT_THUMB_FUNCTION(__udivmodsi4)
#if __ARM_ARCH_EXT_IDIV__
tst r1, r1
beq LOCAL_LABEL(divby0)

View File

@ -27,7 +27,7 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidiv, __udivsi3)
@ unsigned int __udivsi3(unsigned int divident, unsigned int divisor)
@ Calculate and return the quotient of the (unsigned) division.
DEFINE_COMPILERRT_FUNCTION(__udivsi3)
DEFINE_COMPILERRT_THUMB_FUNCTION(__udivsi3)
#if __ARM_ARCH_EXT_IDIV__
tst r1, r1
beq LOCAL_LABEL(divby0)

View File

@ -24,7 +24,7 @@
@ Calculate and return the remainder of the (unsigned) division.
.p2align 2
DEFINE_COMPILERRT_FUNCTION(__umodsi3)
DEFINE_COMPILERRT_THUMB_FUNCTION(__umodsi3)
#if __ARM_ARCH_EXT_IDIV__
tst r1, r1
beq LOCAL_LABEL(divby0)

View File

@ -28,6 +28,10 @@
// tell linker it can break up file at label boundaries
#define FILE_LEVEL_DIRECTIVE .subsections_via_symbols
#define SYMBOL_IS_FUNC(name)
// rdar://problem/18523605
#if __ARM_ARCH_ISA_THUMB == 2
#define THUMB_FUNC .thumb_func
#endif
#elif defined(__ELF__)
#define HIDDEN(name) .hidden name
#define LOCAL_LABEL(name) .L_##name
@ -98,6 +102,14 @@
DECLARE_SYMBOL_VISIBILITY(name) \
SYMBOL_NAME(name):
#define DEFINE_COMPILERRT_THUMB_FUNCTION(name) \
FILE_LEVEL_DIRECTIVE SEPARATOR \
.globl SYMBOL_NAME(name) SEPARATOR \
THUMB_FUNC \
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
DECLARE_SYMBOL_VISIBILITY(name) \
SYMBOL_NAME(name):
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
FILE_LEVEL_DIRECTIVE SEPARATOR \
.globl SYMBOL_NAME(name) SEPARATOR \