[PATCH] D38390: [builtins] ARM: Reland fix for assembling builtins in thumb state.
Manoj Gupta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 28 21:06:45 PDT 2017
manojgupta created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.
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.
https://reviews.llvm.org/D38390
Files:
lib/builtins/arm/aeabi_cdcmp.S
lib/builtins/arm/aeabi_cfcmp.S
lib/builtins/assembly.h
Index: lib/builtins/assembly.h
===================================================================
--- lib/builtins/assembly.h
+++ 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,30 +147,34 @@
#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 \
DECLARE_SYMBOL_VISIBILITY(name) \
DECLARE_FUNC_ENCODING \
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 \
DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR \
.thumb_func SEPARATOR \
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 \
HIDDEN(SYMBOL_NAME(name)) SEPARATOR \
DECLARE_FUNC_ENCODING \
SYMBOL_NAME(name):
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
+ DEFINE_CODE_STATE \
.globl name SEPARATOR \
SYMBOL_IS_FUNC(name) SEPARATOR \
HIDDEN(name) SEPARATOR \
Index: lib/builtins/arm/aeabi_cfcmp.S
===================================================================
--- lib/builtins/arm/aeabi_cfcmp.S
+++ lib/builtins/arm/aeabi_cfcmp.S
@@ -46,9 +46,11 @@
pop {r0-r3, lr}
// NaN has been ruled out, so __aeabi_cfcmple can't trap
+ // Use "it ne" to avoid watchos thumb assembly issue (PR 34768).
+ 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
Index: lib/builtins/arm/aeabi_cdcmp.S
===================================================================
--- lib/builtins/arm/aeabi_cdcmp.S
+++ lib/builtins/arm/aeabi_cdcmp.S
@@ -46,9 +46,11 @@
pop {r0-r3, lr}
// NaN has been ruled out, so __aeabi_cdcmple can't trap
+ // Use "it ne" to avoid watchos thumb assembly issue (PR 34768).
+ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38390.117086.patch
Type: text/x-patch
Size: 4240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170929/6b5e0972/attachment.bin>
More information about the llvm-commits
mailing list