aboutsummaryrefslogtreecommitdiff
path: root/toolchain
diff options
context:
space:
mode:
authorGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-07-16 10:03:22 +0200
committerGravatar Peter Korsgaard <jacmet@sunsite.dk>2013-07-16 15:28:03 +0200
commit85d0769ac5cb50527c5bbab4417262064971073f (patch)
tree06b04d5cd48397df61b840e78876b98263796a8b /toolchain
parentd2e3cc389d47f3f1f3aa5e92e2e00deb9f2f27ba (diff)
downloadbuildroot-85d0769ac5cb50527c5bbab4417262064971073f.tar.gz
buildroot-85d0769ac5cb50527c5bbab4417262064971073f.tar.bz2
arch/arm: add support for Thumb2
Until now, we were using the default ARM instruction set, as used by the toolchain: the 32 bits ARM instruction set for the internal backend, and for external toolchain, whatever default was chosen when the toolchain was generated. This commit adds support for the Thumb2 instruction set. To do so, it: * provides a menuconfig choice between ARM and Thumb2. The choice is only shown when Thumb2 is supported, i.e on ARMv7-A CPUs. * passes the --with-mode={arm,thumb} option when building gcc in the internal backend. This tells the compiler which type of instructions it should generate. * passes the m{arm,thumb} option in the external toolchain wrapper. ARM and Thumb2 code can freely be mixed together, so the fact that the C library has been built either ARM or Thumb2 and that the rest of the code is built Thumb2 or ARM is not a problem. [Peter: fix empty BR2_GCC_TARGET_MODE check] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/toolchain-external/ext-tool.mk5
-rw-r--r--toolchain/toolchain-external/ext-toolchain-wrapper.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index 67fc40d095..b9ae68f0a3 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -147,6 +147,7 @@ CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
CC_TARGET_FPU_:=$(call qstrip,$(BR2_GCC_TARGET_FPU))
CC_TARGET_FLOAT_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
+CC_TARGET_MODE_:=$(call qstrip,$(BR2_GCC_TARGET_MODE))
# march/mtune/floating point mode needs to be passed to the external toolchain
# to select the right multilib variant
@@ -178,6 +179,10 @@ ifneq ($(CC_TARGET_FLOAT_ABI_),)
TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_)
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"'
endif
+ifneq ($(CC_TARGET_MODE_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_)
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"'
+endif
ifeq ($(BR2_BINFMT_FLAT),y)
TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT
diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c
index afca6fab20..460f255ee5 100644
--- a/toolchain/toolchain-external/ext-toolchain-wrapper.c
+++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c
@@ -47,6 +47,9 @@ static char *predef_args[] = {
#ifdef BR_SOFTFLOAT
"-msoft-float",
#endif /* BR_SOFTFLOAT */
+#ifdef BR_MODE
+ "-m" BR_MODE,
+#endif
#ifdef BR_64
"-m64",
#endif