Message ID | 1343162828-13060-1-git-send-email-thomas.petazzoni@free-electrons.com |
---|---|
State | Superseded |
Headers | show |
Hello Gustavo, If you could have a look at the below patch, and provide your comments or Acked-by, it would be great. Thanks a lot! Thomas Le Tue, 24 Jul 2012 22:47:08 +0200, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a écrit : > 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: > > * 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. > > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> > --- > package/Makefile.in | 2 +- > target/Config.in.arch | 28 +++++++++++----------------- > toolchain/uClibc/uclibc.mk | 9 ++++++--- > 3 files changed, 18 insertions(+), 21 deletions(-) > > diff --git a/package/Makefile.in b/package/Makefile.in > index 6fad224..21b8634 100644 > --- a/package/Makefile.in > +++ b/package/Makefile.in > @@ -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 > > diff --git a/target/Config.in.arch b/target/Config.in.arch > index e7aec56..0ef59ef 100644 > --- a/target/Config.in.arch > +++ b/target/Config.in.arch > @@ -271,26 +271,20 @@ choice > prompt "Target ABI" > depends on BR2_mips || BR2_mipsel > default BR2_MIPS_OABI32 if BR_mips_32 || BR_mips_32r2 > - default BR2_MIPS_ABI32 if BR_mips_64 || BR_mips_64r2 > + default BR2_MIPS_NABI32 if BR_mips_64 || BR_mips_64r2 > help > Application Binary Interface to use > > config BR2_MIPS_OABI32 > bool "o32" > -config BR2_MIPS_ABI32 > +config BR2_MIPS_NABI32 > bool "n32" > + select BR2_ARCH_IS_64 > depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 > -config BR2_MIPS_ABI64 > +config BR2_MIPS_NABI64 > bool "n64" > + select BR2_ARCH_IS_64 > depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 > -config BR2_MIPS_OABI64 > - bool "o64" > - depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 > -config BR2_MIPS_ABI_none > - bool "unspecified" > - depends on BR2_mips_16 > - help > - Unspecified ABI leaves ABI selection blank. > endchoice > > choice > @@ -688,8 +682,10 @@ config BR2_ARCH > default "i686" if BR2_x86_athlon_4 > default "m68k" if BR2_m68k > default "microblaze" if BR2_microblaze > - default "mips" if BR2_mips > - default "mipsel" if BR2_mipsel > + default "mips" if BR2_mips && !BR2_ARCH_IS_64 > + default "mipsel" if BR2_mipsel && !BR2_ARCH_IS_64 > + default "mips64" if BR2_mips && BR2_ARCH_IS_64 > + default "mips64el" if BR2_mipsel && BR2_ARCH_IS_64 > default "powerpc" if BR2_powerpc > default "sh2" if BR2_sh2 > default "sh2a" if BR2_sh2a > @@ -904,10 +900,8 @@ config BR2_GCC_TARGET_ABI > default aapcs if BR2_arm_dunno > default aapcs-linux if BR2_ARM_EABI > default 32 if BR2_MIPS_OABI32 > - default n32 if BR2_MIPS_ABI32 > - default eabi if BR2_MIPS_EABI > - default o64 if BR2_MIPS_OABI64 > - default 64 if BR2_MIPS_ABI64 > + default n32 if BR2_MIPS_NABI32 > + default 64 if BR2_MIPS_NABI64 > default mmixware if BR2_mmix && BR2_MMIX_ABI_native > default gnu if BR2_mmix && !BR2_MMIX_ABI_native > default altivec if BR2_powerpc && BR2_PPC_ABI_altivec > diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk > index 9d0b6db..aff0a60 100644 > --- a/toolchain/uClibc/uclibc.mk > +++ b/toolchain/uClibc/uclibc.mk > @@ -38,6 +38,7 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ > -e 's/sh[234].*/sh/' \ > -e 's/mips.*/mips/' \ > -e 's/mipsel.*/mips/' \ > + -e 's/mips64el.*/mips/' \ > -e 's/cris.*/cris/' \ > -e 's/xtensa.*/xtensa/' \ > ") > @@ -45,6 +46,8 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ > UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ > -e 's/armeb/BIG/' \ > -e 's/arm/LITTLE/' \ > + -e 's/mips64el/LITTLE/' \ > + -e 's/mips64/BIG/' \ > -e 's/mipsel/LITTLE/' \ > -e 's/mips/BIG/' \ > -e 's/sh.*eb/BIG/' \ > @@ -155,13 +158,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)
On 07/24/12 22:47, Thomas Petazzoni wrote: > So, this commit reworks the Buildroot MIPS support by: > > * 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. As far as I understand, the situation is a bit similar to PCs, where i386 and x86_64 are in fact quite different even at instruction set level. So wouldn't it make more sense to distinguish mips and mips64 at the 'Target Architecture' level? Then mips would always select o32, and the ABI choice would only exist for mips64. And there would be a 1-to-1 mapping between BR2_ARCH and the user choice, which makes more sense to me. It would require a bit of research to find out which sub-architectures are 64-bit, of course. > * 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. > > Signed-off-by: Thomas Petazzoni<thomas.petazzoni@free-electrons.com> > --- > package/Makefile.in | 2 +- > target/Config.in.arch | 28 +++++++++++----------------- > toolchain/uClibc/uclibc.mk | 9 ++++++--- > 3 files changed, 18 insertions(+), 21 deletions(-) > > diff --git a/package/Makefile.in b/package/Makefile.in > index 6fad224..21b8634 100644 > --- a/package/Makefile.in > +++ b/package/Makefile.in > @@ -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) Any reason why this isn't just ifeq ($(BR2_MIPS_NABI64),y) > TARGET_CFLAGS+=-fno-pic -mno-abicalls > endif > > diff --git a/target/Config.in.arch b/target/Config.in.arch > index e7aec56..0ef59ef 100644 > --- a/target/Config.in.arch > +++ b/target/Config.in.arch > @@ -271,26 +271,20 @@ choice > prompt "Target ABI" > depends on BR2_mips || BR2_mipsel > default BR2_MIPS_OABI32 if BR_mips_32 || BR_mips_32r2 > - default BR2_MIPS_ABI32 if BR_mips_64 || BR_mips_64r2 > + default BR2_MIPS_NABI32 if BR_mips_64 || BR_mips_64r2 > help > Application Binary Interface to use > > config BR2_MIPS_OABI32 > bool "o32" > -config BR2_MIPS_ABI32 > +config BR2_MIPS_NABI32 > bool "n32" > + select BR2_ARCH_IS_64 > depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 > -config BR2_MIPS_ABI64 > +config BR2_MIPS_NABI64 > bool "n64" > + select BR2_ARCH_IS_64 > depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 > -config BR2_MIPS_OABI64 > - bool "o64" > - depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 > -config BR2_MIPS_ABI_none > - bool "unspecified" > - depends on BR2_mips_16 > - help > - Unspecified ABI leaves ABI selection blank. > endchoice > > choice > @@ -688,8 +682,10 @@ config BR2_ARCH > default "i686" if BR2_x86_athlon_4 > default "m68k" if BR2_m68k > default "microblaze" if BR2_microblaze > - default "mips" if BR2_mips > - default "mipsel" if BR2_mipsel > + default "mips" if BR2_mips&& !BR2_ARCH_IS_64 > + default "mipsel" if BR2_mipsel&& !BR2_ARCH_IS_64 > + default "mips64" if BR2_mips&& BR2_ARCH_IS_64 > + default "mips64el" if BR2_mipsel&& BR2_ARCH_IS_64 > default "powerpc" if BR2_powerpc > default "sh2" if BR2_sh2 > default "sh2a" if BR2_sh2a > @@ -904,10 +900,8 @@ config BR2_GCC_TARGET_ABI > default aapcs if BR2_arm_dunno > default aapcs-linux if BR2_ARM_EABI > default 32 if BR2_MIPS_OABI32 > - default n32 if BR2_MIPS_ABI32 > - default eabi if BR2_MIPS_EABI > - default o64 if BR2_MIPS_OABI64 > - default 64 if BR2_MIPS_ABI64 > + default n32 if BR2_MIPS_NABI32 > + default 64 if BR2_MIPS_NABI64 > default mmixware if BR2_mmix && BR2_MMIX_ABI_native > default gnu if BR2_mmix && !BR2_MMIX_ABI_native Unrelated, but what is this BR2_mmix? > default altivec if BR2_powerpc&& BR2_PPC_ABI_altivec > diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk > index 9d0b6db..aff0a60 100644 > --- a/toolchain/uClibc/uclibc.mk > +++ b/toolchain/uClibc/uclibc.mk > @@ -38,6 +38,7 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ > -e 's/sh[234].*/sh/' \ > -e 's/mips.*/mips/' \ > -e 's/mipsel.*/mips/' \ > + -e 's/mips64el.*/mips/' \ This one is already covered by the mips.* expression. Actually, so is the mipsel.* one. Regards, Arnout > -e 's/cris.*/cris/' \ > -e 's/xtensa.*/xtensa/' \ > ") > @@ -45,6 +46,8 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ > UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ > -e 's/armeb/BIG/' \ > -e 's/arm/LITTLE/' \ > + -e 's/mips64el/LITTLE/' \ > + -e 's/mips64/BIG/' \ > -e 's/mipsel/LITTLE/' \ > -e 's/mips/BIG/' \ > -e 's/sh.*eb/BIG/' \ > @@ -155,13 +158,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)
Le Wed, 25 Jul 2012 19:32:26 +0200, Arnout Vandecappelle <arnout@mind.be> a écrit : > As far as I understand, the situation is a bit similar to PCs, where > i386 and x86_64 are in fact quite different even at instruction set > level. So wouldn't it make more sense to distinguish mips and mips64 > at the 'Target Architecture' level? Then mips would always select > o32, and the ABI choice would only exist for mips64. And there > would be a 1-to-1 mapping between BR2_ARCH and the user choice, > which makes more sense to me. Makes sense. Gustavo, what do you think? > It would require a bit of research to find out which sub-architectures > are 64-bit, of course. Right, but it should be doable. The linux-mips.org Wiki has some info, and I know someone who has quite a bit of experience with MIPS stuff, so I could ask. > > -ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_ABI64)),yy) > > +ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_NABI64)),yy) > > Any reason why this isn't just > > ifeq ($(BR2_MIPS_NABI64),y) No, it could be this way. The bigger question is: > > TARGET_CFLAGS+=-fno-pic -mno-abicalls Why are those special CFLAGS needed from the beginning? > > default mmixware if BR2_mmix && BR2_MMIX_ABI_native > > default gnu if BR2_mmix && !BR2_MMIX_ABI_native > > Unrelated, but what is this BR2_mmix? It seems like the BR2_mmix option never existed in Buildroot. But from a quick Google search, MMIX appears to be the fake architecture created by Donald Knuth, which is the descendant of the MIX architecture he created to illustrate the Art of Computer Programming. See http://www-cs-faculty.stanford.edu/~uno/mmix.html. I don't think we really want to support this architecture. > This one is already covered by the mips.* expression. Actually, > so is the mipsel.* one. Right. Thomas
Le Wed, 25 Jul 2012 20:25:03 +0200, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a écrit : > Le Wed, 25 Jul 2012 19:32:26 +0200, > Arnout Vandecappelle <arnout@mind.be> a écrit : > > > As far as I understand, the situation is a bit similar to PCs, where > > i386 and x86_64 are in fact quite different even at instruction set > > level. So wouldn't it make more sense to distinguish mips and mips64 > > at the 'Target Architecture' level? Then mips would always select > > o32, and the ABI choice would only exist for mips64. And there > > would be a 1-to-1 mapping between BR2_ARCH and the user choice, > > which makes more sense to me. > > Makes sense. Gustavo, what do you think? > > > It would require a bit of research to find out which sub-architectures > > are 64-bit, of course. > > Right, but it should be doable. The linux-mips.org Wiki has some info, > and I know someone who has quite a bit of experience with MIPS stuff, > so I could ask. Thinking more about this, the way we do things for i386 vs. x86_64 is not optimal: there are two complete distinct sets of entries for the processor types. One for i386, one for x86_64. However, there should normally be a big overlap between the two, since all x86_64 processors support the i386 architecture. So maybe we should have a single list, with certain processor not being visible in the i386. This would ensure consistency between the list of processors available on i386 and x86_64. Thoughts? Thomas
On 07/25/12 15:25, Thomas Petazzoni wrote: > Le Wed, 25 Jul 2012 19:32:26 +0200, > Arnout Vandecappelle <arnout@mind.be> a écrit : > >> As far as I understand, the situation is a bit similar to PCs, where >> i386 and x86_64 are in fact quite different even at instruction set >> level. So wouldn't it make more sense to distinguish mips and mips64 >> at the 'Target Architecture' level? Then mips would always select >> o32, and the ABI choice would only exist for mips64. And there >> would be a 1-to-1 mapping between BR2_ARCH and the user choice, >> which makes more sense to me. > > Makes sense. Gustavo, what do you think? Yes, it's the best option since we'll have the same dilemma sooner or latter with powerpc(64) for example. > No, it could be this way. The bigger question is: > >>> TARGET_CFLAGS+=-fno-pic -mno-abicalls > > Why are those special CFLAGS needed from the beginning? From what i could unearth it basically breaks dynamic linking though it makes for smaller binaries. I've tried removing it in my tests to get uClibc dynamic linking working but something else is wrong, seemingly in the uClibc side. For starters the loader is wrong, ld-linux in the target vs. ld64-linux wanted by ELF files. And it seems there's something funky in the uClibc Makefile about that (wants mips64 arch to build it, but they're using unified ARCH as the kernel, so...) Regards.
Le Wed, 25 Jul 2012 17:25:11 -0300, Gustavo Zacarias <gustavo@zacarias.com.ar> a écrit : > > Makes sense. Gustavo, what do you think? > > Yes, it's the best option since we'll have the same dilemma sooner or > latter with powerpc(64) for example. Ok. > > No, it could be this way. The bigger question is: > > > >>> TARGET_CFLAGS+=-fno-pic -mno-abicalls > > > > Why are those special CFLAGS needed from the beginning? > > From what i could unearth it basically breaks dynamic linking though it > makes for smaller binaries. > I've tried removing it in my tests to get uClibc dynamic linking working > but something else is wrong, seemingly in the uClibc side. > For starters the loader is wrong, ld-linux in the target vs. ld64-linux > wanted by ELF files. And it seems there's something funky in the uClibc > Makefile about that (wants mips64 arch to build it, but they're using > unified ARCH as the kernel, so...) Do you have a working mips64 kernel under Qemu? I vaguely remember that you said that it was working with statically linked binary, but not dynamically linked ones. Is this correct? If you have a working mips64 kernel under Qemu, I'm interested by the kernel config and Qemu config. Thanks, Thomas
diff --git a/package/Makefile.in b/package/Makefile.in index 6fad224..21b8634 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -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 diff --git a/target/Config.in.arch b/target/Config.in.arch index e7aec56..0ef59ef 100644 --- a/target/Config.in.arch +++ b/target/Config.in.arch @@ -271,26 +271,20 @@ choice prompt "Target ABI" depends on BR2_mips || BR2_mipsel default BR2_MIPS_OABI32 if BR_mips_32 || BR_mips_32r2 - default BR2_MIPS_ABI32 if BR_mips_64 || BR_mips_64r2 + default BR2_MIPS_NABI32 if BR_mips_64 || BR_mips_64r2 help Application Binary Interface to use config BR2_MIPS_OABI32 bool "o32" -config BR2_MIPS_ABI32 +config BR2_MIPS_NABI32 bool "n32" + select BR2_ARCH_IS_64 depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 -config BR2_MIPS_ABI64 +config BR2_MIPS_NABI64 bool "n64" + select BR2_ARCH_IS_64 depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 -config BR2_MIPS_OABI64 - bool "o64" - depends on BR2_mips_3 || BR2_mips_4 || BR2_mips_64 || BR2_mips_64r2 || BR2_mips_16 -config BR2_MIPS_ABI_none - bool "unspecified" - depends on BR2_mips_16 - help - Unspecified ABI leaves ABI selection blank. endchoice choice @@ -688,8 +682,10 @@ config BR2_ARCH default "i686" if BR2_x86_athlon_4 default "m68k" if BR2_m68k default "microblaze" if BR2_microblaze - default "mips" if BR2_mips - default "mipsel" if BR2_mipsel + default "mips" if BR2_mips && !BR2_ARCH_IS_64 + default "mipsel" if BR2_mipsel && !BR2_ARCH_IS_64 + default "mips64" if BR2_mips && BR2_ARCH_IS_64 + default "mips64el" if BR2_mipsel && BR2_ARCH_IS_64 default "powerpc" if BR2_powerpc default "sh2" if BR2_sh2 default "sh2a" if BR2_sh2a @@ -904,10 +900,8 @@ config BR2_GCC_TARGET_ABI default aapcs if BR2_arm_dunno default aapcs-linux if BR2_ARM_EABI default 32 if BR2_MIPS_OABI32 - default n32 if BR2_MIPS_ABI32 - default eabi if BR2_MIPS_EABI - default o64 if BR2_MIPS_OABI64 - default 64 if BR2_MIPS_ABI64 + default n32 if BR2_MIPS_NABI32 + default 64 if BR2_MIPS_NABI64 default mmixware if BR2_mmix && BR2_MMIX_ABI_native default gnu if BR2_mmix && !BR2_MMIX_ABI_native default altivec if BR2_powerpc && BR2_PPC_ABI_altivec diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk index 9d0b6db..aff0a60 100644 --- a/toolchain/uClibc/uclibc.mk +++ b/toolchain/uClibc/uclibc.mk @@ -38,6 +38,7 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ -e 's/sh[234].*/sh/' \ -e 's/mips.*/mips/' \ -e 's/mipsel.*/mips/' \ + -e 's/mips64el.*/mips/' \ -e 's/cris.*/cris/' \ -e 's/xtensa.*/xtensa/' \ ") @@ -45,6 +46,8 @@ UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ -e 's/armeb/BIG/' \ -e 's/arm/LITTLE/' \ + -e 's/mips64el/LITTLE/' \ + -e 's/mips64/BIG/' \ -e 's/mipsel/LITTLE/' \ -e 's/mips/BIG/' \ -e 's/sh.*eb/BIG/' \ @@ -155,13 +158,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)
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: * 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. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> --- package/Makefile.in | 2 +- target/Config.in.arch | 28 +++++++++++----------------- toolchain/uClibc/uclibc.mk | 9 ++++++--- 3 files changed, 18 insertions(+), 21 deletions(-)