Skip to contentSkip to conversation

Clarify MIPS ABIs support

Buildroot Peter Korsgaard 1 participant 1 message Sep 4, 2012

lore
Share & tools
lore
#0 lore raw

commit: http://git.buildroot.net/buildroot/commit/?id=8e55f03a545e12ef3c149541b8aa25b31c3e927a
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Practically speaking, MIPS has three useful ABIs:

* o32 is for 32-bits CPUs, or 64-bit CPUs running only a 32-bit subset of the instruction set.
* n32 is for 64-bits CPUs only. It has 32-bits pointers and long integers.
* n64 is for 64-bits CPUs only. It has 64-bits pointers and long integers.

See http://www.linux-mips.org/wiki/MIPS_ABI_History and
http://www.linux-mips.org/wiki/WhatsWrongWithO32N32N64 for more details.

So, this commit reworks the Buildroot MIPS support by:

* Add separate mips64/mips64el top-level architectures.

* Renaming the n32 ABI option to BR2_MIPS_NABI32, for consistency with BR2_MIPS_OABI32.

* Renaming the n64 ABI option to BR2_MIPS_NABI64, for consistency with BR2_MIPS_OABI32.

* Make the n32 and n64 ABI selections select the BR2_ARCH_IS_64, since those ABIs are valid on 64-bits CPUs only.

* Removing the o64 ABI, which is practicaly never used.

* Removing the "none" ABI, which really doesn't make sense.

* Introduce the mips64 and mips64el architecture names when a 64-bits MIPS ABI is choosen. This will fix build issue like
http://autobuild.buildroot.org/results/9b8c5ea86c953a89e85e7b67e9221de41773f652/build-end.log
where gmp was confused by the fact of having a 32 bits architecture (detected by the mips- architecture part of the tuple) but 64 bits integer size when compiling.

* Adjust the uclibc.mk logic to support the new mips64/mips64el architecture names, and take into account the renaming of the ABI options.

This has been build tested by generating Buildroot toolchains and compiling a few packages for MIPS o32, MIPS n32 and MIPS n64.

This work is originally based on prior work done by Gustavo Zacarias.

---
 package/Makefile.in        |    2 +-
 target/Config.in.arch      |   60 +++++++++++++++++++++++++------------------
 toolchain/uClibc/uclibc.mk |    7 ++---
 3 files changed, 39 insertions(+), 30 deletions(-)
package/Makefile.in +1 -1
index 6fad224..21b8634 100644
@@ -87,7 +87,7 @@ endif
 
 TARGET_CFLAGS=$(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
 
-ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_ABI64)),yy)
+ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_NABI64)),yy)
 TARGET_CFLAGS+=-fno-pic -mno-abicalls
 endif
 
target/Config.in.arch +35 -25

132 lines not on this page · raw message

toolchain/uClibc/uclibc.mk +3 -4
index 583d199..534550a 100644
@@ -37,7 +37,6 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
 		-e 's/v850.*/v850/g' \
 		-e 's/sh[234].*/sh/' \
 		-e 's/mips.*/mips/' \
-		-e 's/mipsel.*/mips/' \
 		-e 's/cris.*/cris/' \
 		-e 's/xtensa.*/xtensa/' \
 ")
@@ -142,13 +141,13 @@ ifeq ($(UCLIBC_TARGET_ARCH),mips)
 	 /bin/echo "# CONFIG_MIPS_ISA_MIPS32R2 is not set"; \
 	 /bin/echo "# CONFIG_MIPS_ISA_MIPS64 is not set"; \
 	) >> $(UCLIBC_DIR)/.oldconfig
-ifeq ($(BR2_MIPS_OABI),y)
+ifeq ($(BR2_MIPS_OABI32),y)
 	$(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
 endif
-ifeq ($(BR2_MIPS_ABI32),y)
+ifeq ($(BR2_MIPS_NABI32),y)
 	$(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
 endif
-ifeq ($(BR2_MIPS_ABI64),y)
+ifeq ($(BR2_MIPS_NABI64),y)
 	$(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
 endif
 ifeq ($(BR2_mips_1),y)