2019-04-29 06:47:49 +08:00
|
|
|
//===-- assembly.h - compiler-rt assembler support macros -----------------===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines macros for use in compiler-rt assembler source.
|
|
|
|
// This file is not part of the interface of this library.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-10-28 01:49:50 +08:00
|
|
|
|
|
|
|
#ifndef COMPILERRT_ASSEMBLY_H
|
|
|
|
#define COMPILERRT_ASSEMBLY_H
|
|
|
|
|
|
|
|
#if defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__)
|
|
|
|
#define SEPARATOR @
|
|
|
|
#else
|
|
|
|
#define SEPARATOR ;
|
2010-01-19 06:19:25 +08:00
|
|
|
#endif
|
2009-10-28 01:49:50 +08:00
|
|
|
|
2010-01-19 06:19:25 +08:00
|
|
|
#if defined(__APPLE__)
|
2014-05-19 02:39:10 +08:00
|
|
|
#define HIDDEN(name) .private_extern name
|
2011-04-20 01:50:09 +08:00
|
|
|
#define LOCAL_LABEL(name) L_##name
|
2014-05-13 01:38:36 +08:00
|
|
|
// tell linker it can break up file at label boundaries
|
2014-05-16 14:16:21 +08:00
|
|
|
#define FILE_LEVEL_DIRECTIVE .subsections_via_symbols
|
2014-01-15 07:31:23 +08:00
|
|
|
#define SYMBOL_IS_FUNC(name)
|
2014-12-10 10:36:22 +08:00
|
|
|
#define CONST_SECTION .const
|
2014-10-05 04:11:10 +08:00
|
|
|
|
2016-06-23 06:09:42 +08:00
|
|
|
#define NO_EXEC_STACK_DIRECTIVE
|
|
|
|
|
2014-05-19 02:39:15 +08:00
|
|
|
#elif defined(__ELF__)
|
2014-10-05 04:11:10 +08:00
|
|
|
|
2014-05-19 02:39:10 +08:00
|
|
|
#define HIDDEN(name) .hidden name
|
2011-04-20 01:50:09 +08:00
|
|
|
#define LOCAL_LABEL(name) .L_##name
|
2014-01-15 07:31:23 +08:00
|
|
|
#define FILE_LEVEL_DIRECTIVE
|
2014-05-16 14:16:21 +08:00
|
|
|
#if defined(__arm__)
|
|
|
|
#define SYMBOL_IS_FUNC(name) .type name,%function
|
|
|
|
#else
|
|
|
|
#define SYMBOL_IS_FUNC(name) .type name,@function
|
|
|
|
#endif
|
2014-12-10 10:36:22 +08:00
|
|
|
#define CONST_SECTION .section .rodata
|
2014-10-05 04:11:10 +08:00
|
|
|
|
2017-05-16 07:13:54 +08:00
|
|
|
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
|
|
|
|
defined(__linux__)
|
2016-06-23 06:09:42 +08:00
|
|
|
#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
|
|
|
|
#else
|
|
|
|
#define NO_EXEC_STACK_DIRECTIVE
|
|
|
|
#endif
|
|
|
|
|
2014-10-05 04:11:10 +08:00
|
|
|
#else // !__APPLE__ && !__ELF__
|
|
|
|
|
2014-12-10 10:36:22 +08:00
|
|
|
#define HIDDEN(name)
|
2014-05-19 02:39:15 +08:00
|
|
|
#define LOCAL_LABEL(name) .L ## name
|
2014-10-07 10:39:13 +08:00
|
|
|
#define FILE_LEVEL_DIRECTIVE
|
2014-05-19 02:39:15 +08:00
|
|
|
#define SYMBOL_IS_FUNC(name) \
|
|
|
|
.def name SEPARATOR \
|
2014-06-21 09:41:21 +08:00
|
|
|
.scl 2 SEPARATOR \
|
2014-05-19 02:39:15 +08:00
|
|
|
.type 32 SEPARATOR \
|
|
|
|
.endef
|
2014-12-10 10:36:22 +08:00
|
|
|
#define CONST_SECTION .section .rdata,"rd"
|
2014-10-07 10:39:13 +08:00
|
|
|
|
2016-06-23 06:09:42 +08:00
|
|
|
#define NO_EXEC_STACK_DIRECTIVE
|
|
|
|
|
2009-10-28 01:49:50 +08:00
|
|
|
#endif
|
|
|
|
|
2014-01-24 21:39:51 +08:00
|
|
|
#if defined(__arm__)
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
|
2019-04-29 06:47:49 +08:00
|
|
|
// Determine actual [ARM][THUMB[1][2]] ISA using compiler predefined macros:
|
|
|
|
// - for '-mthumb -march=armv6' compiler defines '__thumb__'
|
|
|
|
// - for '-mthumb -march=armv7' compiler defines '__thumb__' and '__thumb2__'
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
#if defined(__thumb2__) || defined(__thumb__)
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
#define DEFINE_CODE_STATE .thumb SEPARATOR
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
#define DECLARE_FUNC_ENCODING .thumb_func SEPARATOR
|
|
|
|
#if defined(__thumb2__)
|
|
|
|
#define USE_THUMB_2
|
|
|
|
#define IT(cond) it cond
|
|
|
|
#define ITT(cond) itt cond
|
|
|
|
#define ITE(cond) ite cond
|
|
|
|
#else
|
|
|
|
#define USE_THUMB_1
|
|
|
|
#define IT(cond)
|
|
|
|
#define ITT(cond)
|
|
|
|
#define ITE(cond)
|
|
|
|
#endif // defined(__thumb__2)
|
|
|
|
#else // !defined(__thumb2__) && !defined(__thumb__)
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
#define DEFINE_CODE_STATE .arm SEPARATOR
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
#define DECLARE_FUNC_ENCODING
|
|
|
|
#define IT(cond)
|
|
|
|
#define ITT(cond)
|
|
|
|
#define ITE(cond)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(USE_THUMB_1) && defined(USE_THUMB_2)
|
|
|
|
#error "USE_THUMB_1 and USE_THUMB_2 can't be defined together."
|
|
|
|
#endif
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#if defined(__ARM_ARCH_4T__) || __ARM_ARCH >= 5
|
|
|
|
#define ARM_HAS_BX
|
|
|
|
#endif
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
#if !defined(__ARM_FEATURE_CLZ) && !defined(USE_THUMB_1) && \
|
2016-12-08 02:41:07 +08:00
|
|
|
(__ARM_ARCH >= 6 || (__ARM_ARCH == 5 && !defined(__ARM_ARCH_5__)))
|
2014-05-16 14:16:21 +08:00
|
|
|
#define __ARM_FEATURE_CLZ
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ARM_HAS_BX
|
|
|
|
#define JMP(r) bx r
|
2014-07-21 04:00:26 +08:00
|
|
|
#define JMPc(r, c) bx##c r
|
2014-05-16 14:16:21 +08:00
|
|
|
#else
|
|
|
|
#define JMP(r) mov pc, r
|
|
|
|
#define JMPc(r, c) mov##c pc, r
|
|
|
|
#endif
|
2014-07-27 10:01:20 +08:00
|
|
|
|
2015-08-21 08:25:37 +08:00
|
|
|
// pop {pc} can't switch Thumb mode on ARMv4T
|
|
|
|
#if __ARM_ARCH >= 5
|
|
|
|
#define POP_PC() pop {pc}
|
|
|
|
#else
|
|
|
|
#define POP_PC() \
|
|
|
|
pop {ip}; \
|
|
|
|
JMP(ip)
|
|
|
|
#endif
|
|
|
|
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
#if defined(USE_THUMB_2)
|
2017-03-25 01:08:35 +08:00
|
|
|
#define WIDE(op) op.w
|
|
|
|
#else
|
2014-07-27 10:01:24 +08:00
|
|
|
#define WIDE(op) op
|
|
|
|
#endif
|
2017-08-15 05:44:33 +08:00
|
|
|
#else // !defined(__arm)
|
|
|
|
#define DECLARE_FUNC_ENCODING
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
#define DEFINE_CODE_STATE
|
2017-03-25 01:08:35 +08:00
|
|
|
#endif
|
2014-05-16 14:16:21 +08:00
|
|
|
|
|
|
|
#define GLUE2(a, b) a##b
|
2011-04-20 05:22:14 +08:00
|
|
|
#define GLUE(a, b) GLUE2(a, b)
|
|
|
|
#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
|
|
|
|
|
2012-02-11 00:41:46 +08:00
|
|
|
#ifdef VISIBILITY_HIDDEN
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DECLARE_SYMBOL_VISIBILITY(name) \
|
2014-05-19 02:39:10 +08:00
|
|
|
HIDDEN(SYMBOL_NAME(name)) SEPARATOR
|
2010-01-19 06:19:34 +08:00
|
|
|
#else
|
2011-08-23 05:49:47 +08:00
|
|
|
#define DECLARE_SYMBOL_VISIBILITY(name)
|
|
|
|
#endif
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_FUNCTION(name) \
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
DEFINE_CODE_STATE \
|
2014-05-16 14:16:21 +08:00
|
|
|
FILE_LEVEL_DIRECTIVE SEPARATOR \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
|
|
|
DECLARE_SYMBOL_VISIBILITY(name) \
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
DECLARE_FUNC_ENCODING \
|
2009-10-28 01:49:50 +08:00
|
|
|
SYMBOL_NAME(name):
|
|
|
|
|
2014-10-04 08:18:59 +08:00
|
|
|
#define DEFINE_COMPILERRT_THUMB_FUNCTION(name) \
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
DEFINE_CODE_STATE \
|
2014-10-04 08:18:59 +08:00
|
|
|
FILE_LEVEL_DIRECTIVE SEPARATOR \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
2014-10-07 10:39:13 +08:00
|
|
|
DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR \
|
2014-10-07 11:00:17 +08:00
|
|
|
.thumb_func SEPARATOR \
|
2014-10-04 08:18:59 +08:00
|
|
|
SYMBOL_NAME(name):
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
DEFINE_CODE_STATE \
|
2014-05-16 14:16:21 +08:00
|
|
|
FILE_LEVEL_DIRECTIVE SEPARATOR \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
2014-05-19 02:39:10 +08:00
|
|
|
HIDDEN(SYMBOL_NAME(name)) SEPARATOR \
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
DECLARE_FUNC_ENCODING \
|
2009-10-28 01:49:50 +08:00
|
|
|
SYMBOL_NAME(name):
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
|
[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
2017-10-03 04:56:49 +08:00
|
|
|
DEFINE_CODE_STATE \
|
2014-05-16 14:16:21 +08:00
|
|
|
.globl name SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(name) SEPARATOR \
|
2014-05-19 02:39:10 +08:00
|
|
|
HIDDEN(name) SEPARATOR \
|
[builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA
Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.
Due to this:
•use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB
•use '.thumb' directive consistently in all affected files
•decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION()
(This is based off Michal's patch https://reviews.llvm.org/D30938)
Reviewers: dim, rengolin, compnerd, strejda
Reviewed By: compnerd
Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits
Differential Revision: https://reviews.llvm.org/D31220
llvm-svn: 310884
2017-08-15 04:48:47 +08:00
|
|
|
DECLARE_FUNC_ENCODING \
|
2010-01-19 06:19:20 +08:00
|
|
|
name:
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \
|
|
|
|
.globl SYMBOL_NAME(name) SEPARATOR \
|
|
|
|
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
2016-10-29 07:37:50 +08:00
|
|
|
DECLARE_SYMBOL_VISIBILITY(SYMBOL_NAME(name)) SEPARATOR \
|
2011-04-20 01:51:24 +08:00
|
|
|
.set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR
|
|
|
|
|
2014-05-16 14:16:21 +08:00
|
|
|
#if defined(__ARM_EABI__)
|
|
|
|
#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \
|
2011-04-20 01:51:24 +08:00
|
|
|
DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name)
|
|
|
|
#else
|
2014-05-16 14:16:21 +08:00
|
|
|
#define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name)
|
2011-04-20 01:51:24 +08:00
|
|
|
#endif
|
|
|
|
|
2014-01-24 02:31:46 +08:00
|
|
|
#ifdef __ELF__
|
2014-05-16 14:16:21 +08:00
|
|
|
#define END_COMPILERRT_FUNCTION(name) \
|
|
|
|
.size SYMBOL_NAME(name), . - SYMBOL_NAME(name)
|
2014-01-24 02:31:46 +08:00
|
|
|
#else
|
|
|
|
#define END_COMPILERRT_FUNCTION(name)
|
|
|
|
#endif
|
|
|
|
|
2019-04-29 06:47:49 +08:00
|
|
|
#endif // COMPILERRT_ASSEMBLY_H
|