arch: arm: aarch32: Allow selecting compiler instruction set

This commit introduces the `COMPILER_ISA_THUMB2` symbol to allow
choosing either the ARM or Thumb instruction set for C code
compilation.

In addition, this commit introduces the `ASSEMBLER_ISA_THUMB2` helper
symbol to specify the default target instruction set for the assembler.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2020-02-12 15:16:39 +09:00 committed by Ioannis Glaropoulos
commit 0bd86f3604
4 changed files with 55 additions and 22 deletions

View file

@ -232,28 +232,24 @@ do { \
#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
#if defined(CONFIG_ISA_THUMB2)
#if defined(CONFIG_ASSEMBLER_ISA_THUMB2)
#define FUNC_CODE() .thumb;
#define FUNC_INSTR(a)
#elif defined(CONFIG_ISA_ARM)
#else
#define FUNC_CODE() .code 32
#define FUNC_INSTR(a)
#else
#error unknown instruction set
#endif /* ISA */
#endif /* CONFIG_ASSEMBLER_ISA_THUMB2 */
#else
#define FUNC_CODE()
#define FUNC_INSTR(a)
#endif /* !CONFIG_ARM */
#endif /* CONFIG_ARM && !CONFIG_ARM64 */
#endif /* _ASMLANGUAGE */
@ -359,14 +355,16 @@ do { \
#endif /* _ASMLANGUAGE */
#if defined(CONFIG_ARM) && defined(_ASMLANGUAGE)
#if defined(CONFIG_ISA_THUMB2)
#if defined(_ASMLANGUAGE)
#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
#if defined(CONFIG_ASSEMBLER_ISA_THUMB2)
/* '.syntax unified' is a gcc-ism used in thumb-2 asm files */
#define _ASM_FILE_PROLOGUE .text; .syntax unified; .thumb
#else
#define _ASM_FILE_PROLOGUE .text; .code 32
#endif
#endif
#endif /* CONFIG_ASSEMBLER_ISA_THUMB2 */
#endif /* CONFIG_ARM && !CONFIG_ARM64 */
#endif /* _ASMLANGUAGE */
/*
* These macros generate absolute symbols for GCC