Message ID | 1300137298-23836-4-git-send-email-daniel.schwierzeck@googlemail.com |
---|---|
State | Superseded, archived |
Headers | show |
On 3/15/11 6:14 AM, daniel.schwierzeck@googlemail.com wrote: > Replace the current MIPSFLAGS code by cc-option macro and use > -march=mips32r2 as default optimization level for all Mips32 CPUs. > Replace the endianess determination code from toolchain prefix by > a more generic one inspired by the Linux arch/mips/Makefile. [...] > -ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) > -ENDIANNESS = -EL > -else > -ENDIANNESS = -EB > -endif > +# Optimization flags for all Mips32 CPUs > +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2) > > -MIPSFLAGS += $(ENDIANNESS) > +# Determine endianess from toolchain prefix > +ENDIANESS = $(shell $(CC) -dumpmachine | \ > + grep -q 'mips.*el-.*'&& echo -EL || echo -EB) > + > +PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANESS) > > -PLATFORM_CPPFLAGS += $(MIPSFLAGS) This trick can not work with the ELDK toolchain, which also I don't want to think about and be involved in discussion any more. See: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572/focus=81735 Users who need to dig into this area should install the ELDK first, build little-endian targets with it by yourself, then find a way to handle endianness appropriately which works for both the ELDK and non-ELDK toolchains. Or I may miss something. If it's already verified with the ELDK, please let me know, thanks.
Hi Shinya, 2011/3/15 Shinya Kuribayashi <skuribay@pobox.com>: > On 3/15/11 6:14 AM, daniel.schwierzeck@googlemail.com wrote: >> >> Replace the current MIPSFLAGS code by cc-option macro and use >> -march=mips32r2 as default optimization level for all Mips32 CPUs. >> Replace the endianess determination code from toolchain prefix by >> a more generic one inspired by the Linux arch/mips/Makefile. > > [...] >> >> -ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) >> -ENDIANNESS = -EL >> -else >> -ENDIANNESS = -EB >> -endif >> +# Optimization flags for all Mips32 CPUs >> +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2) >> >> -MIPSFLAGS += $(ENDIANNESS) >> +# Determine endianess from toolchain prefix >> +ENDIANESS = $(shell $(CC) -dumpmachine | \ >> + grep -q 'mips.*el-.*'&& echo -EL || echo -EB) >> + >> +PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANESS) >> >> -PLATFORM_CPPFLAGS += $(MIPSFLAGS) > > This trick can not work with the ELDK toolchain, which also I don't > want to think about and be involved in discussion any more. See: > > http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572/focus=81735 sorry, I missed that discussion > Users who need to dig into this area should install the ELDK first, > build little-endian targets with it by yourself, then find a way > to handle endianness appropriately which works for both the ELDK and > non-ELDK toolchains. > > Or I may miss something. If it's already verified with the ELDK, > please let me know, thanks. > The following code works with ELDK (mips_4KC and mips_4KCle) and my non-ELDK BE toolchain. ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) ENDIANESS = -EL else ifneq (,$(findstring 4KC,$(CROSS_COMPILE))) ENDIANESS = -EB else ENDIANESS = $(shell $(CC) -dumpmachine | \ grep -q 'mips.*el-.*' && echo -EL || echo -EB) endif Do we need this endianess flag stuff at all? Each toolchain that is built with a specific endinaness does not really need the extra setting of -EB/-EL or am I miss something? Daniel
On 3/15/11 10:20 PM, Daniel Schwierzeck wrote: >> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572/focus=81735 > > sorry, I missed that discussion You can find a lot more in the list archive. > Do we need this endianess flag stuff at all? Each toolchain that is > built with a specific > endinaness does not really need the extra setting of -EB/-EL or am I > miss something? True, as far as toolchain-default-endianness build goes. The Linux/MIPS kernel however is maintained where Big-Endian and Little- -Endian machines can be configured and compiled using a single toolchain, regardless of its default endianness. CONFIG_LITTLE_ENDIAN is exactly for that purpose.
2011/3/16 Shinya Kuribayashi <skuribay@pobox.com>: > On 3/15/11 10:20 PM, Daniel Schwierzeck wrote: >>> >>> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572/focus=81735 >> >> sorry, I missed that discussion > > You can find a lot more in the list archive. ok I looked through the past discussions and it seems there is no right solution or approach yet. I'll revert the endianess stuff in my patch. Sorry for the noise ;) Is my approach with -march acceptable? This is more important to me for supporting new SoCs with 24k and 34k CPU cores. I think its a clean approach to use a default Mips32 architecture optimization plus a per CPU optimization configured in the SoC directories. Daniel
On 03/16/2011 11:41 PM, Daniel Schwierzeck wrote: > Is my approach with -march acceptable? This is more important to me > for supporting new SoCs with 24k and 34k CPU cores. I think its a > clean approach to use a default Mips32 architecture optimization plus > a per CPU optimization configured in the SoC directories. IIUC this is a binutils related issue. > @@ -20,20 +20,13 @@ > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, > # MA 02111-1307 USA > # > -v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2) > -MIPSFLAGS:=$(shell \ > -if [ "$v" -lt "14" ]; then \ > - echo "-mcpu=4kc"; \ > -else \ > - echo "-march=4kc -mtune=4kc"; \ > -fi) > > [...] > +# Optimization flags for all Mips32 CPUs > +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2) According to GNU gas NEWS, mips32r2 support was introduced in 2.14: http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gas/NEWS?rev=1.117&content-type=text/plain&cvsroot=src&only_with_tag=binutils-binutils-2_21 On the other hand, we have a number of the ELDK releases so far, and their binutils versions vary from 2.11 (ELDK2.1.0) to 2.16.1 (ELDK4.1). 2.1.0: http://mirror.switch.ch/ftp/mirror/eldk/2.1.0/eldk-mips-linux-x86/README.html 3.0: (N/A for MIPS?) 3.1: http://mirror.switch.ch/ftp/mirror/eldk/3.1/mips-linux-x86/distribution/README.html 3.1.1: http://mirror.switch.ch/ftp/mirror/eldk/3.1.1/mips-linux-x86/distribution/README.html 4.0: http://mirror.switch.ch/ftp/mirror/eldk/4.0/mips-linux-x86/distribution/README.html http://www.denx.de/en/News/PressReleaseELDK40 4.1: http://mirror.switch.ch/ftp/mirror/eldk/4.1/mips-linux-x86/distribution/README.html http://www.denx.de/en/News/PressReleaseELDK41 4.2: (N/A for MIPS?) Does above change break any builds with older binutils? Personally, I'm ok with dropping older toolchains to some extent. However, if it breaks builds with older toolchains, strictly speaking older versions of the ELDK releases, the decision is up to Wolfgang. Along with the code, it'd be nice to provide a note in the git commit log about which ELDK version(s) will be affected by this change. I'm not sure that anyone still uses the ELSK2.1.0 in the wild, nor current U-Boot/MIPS can be built with it, though.
2011/3/17 Shinya Kuribayashi <skuribay@pobox.com>: > On 03/16/2011 11:41 PM, Daniel Schwierzeck wrote: >> Is my approach with -march acceptable? This is more important to me >> for supporting new SoCs with 24k and 34k CPU cores. I think its a >> clean approach to use a default Mips32 architecture optimization plus >> a per CPU optimization configured in the SoC directories. > > IIUC this is a binutils related issue. > >> @@ -20,20 +20,13 @@ >> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, >> # MA 02111-1307 USA >> # >> -v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2) >> -MIPSFLAGS:=$(shell \ >> -if [ "$v" -lt "14" ]; then \ >> - echo "-mcpu=4kc"; \ >> -else \ >> - echo "-march=4kc -mtune=4kc"; \ >> -fi) >> >> [...] >> +# Optimization flags for all Mips32 CPUs >> +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2) > > According to GNU gas NEWS, mips32r2 support was introduced in 2.14: > > http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gas/NEWS?rev=1.117&content-type=text/plain&cvsroot=src&only_with_tag=binutils-binutils-2_21 > > On the other hand, we have a number of the ELDK releases so far, and > their binutils versions vary from 2.11 (ELDK2.1.0) to 2.16.1 (ELDK4.1). > > 2.1.0: http://mirror.switch.ch/ftp/mirror/eldk/2.1.0/eldk-mips-linux-x86/README.html > 3.0: (N/A for MIPS?) > 3.1: http://mirror.switch.ch/ftp/mirror/eldk/3.1/mips-linux-x86/distribution/README.html > 3.1.1: http://mirror.switch.ch/ftp/mirror/eldk/3.1.1/mips-linux-x86/distribution/README.html > 4.0: http://mirror.switch.ch/ftp/mirror/eldk/4.0/mips-linux-x86/distribution/README.html > http://www.denx.de/en/News/PressReleaseELDK40 > 4.1: http://mirror.switch.ch/ftp/mirror/eldk/4.1/mips-linux-x86/distribution/README.html > http://www.denx.de/en/News/PressReleaseELDK41 > 4.2: (N/A for MIPS?) > > Does above change break any builds with older binutils? Personally, I'm > ok with dropping older toolchains to some extent. However, if it breaks > builds with older toolchains, strictly speaking older versions of the > ELDK releases, the decision is up to Wolfgang. Ok I'll test with pre-4.1 ELDK releases too and adapt the code if necessary. > > Along with the code, it'd be nice to provide a note in the git commit > log about which ELDK version(s) will be affected by this change. I'm > not sure that anyone still uses the ELSK2.1.0 in the wild, nor current > U-Boot/MIPS can be built with it, though. Next time I'll provide a Tested-with ELDK x.y line in the patch for those changes. Thanks for the feedback. Daniel
Hi Shinya, 2011/3/17 Shinya Kuribayashi <skuribay@pobox.com>: > On 03/16/2011 11:41 PM, Daniel Schwierzeck wrote: >> Is my approach with -march acceptable? This is more important to me >> for supporting new SoCs with 24k and 34k CPU cores. I think its a >> clean approach to use a default Mips32 architecture optimization plus >> a per CPU optimization configured in the SoC directories. > > IIUC this is a binutils related issue. > >> @@ -20,20 +20,13 @@ >> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, >> # MA 02111-1307 USA >> # >> -v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2) >> -MIPSFLAGS:=$(shell \ >> -if [ "$v" -lt "14" ]; then \ >> - echo "-mcpu=4kc"; \ >> -else \ >> - echo "-march=4kc -mtune=4kc"; \ >> -fi) >> >> [...] >> +# Optimization flags for all Mips32 CPUs >> +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2) > > According to GNU gas NEWS, mips32r2 support was introduced in 2.14: > > http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gas/NEWS?rev=1.117&content-type=text/plain&cvsroot=src&only_with_tag=binutils-binutils-2_21 > > On the other hand, we have a number of the ELDK releases so far, and > their binutils versions vary from 2.11 (ELDK2.1.0) to 2.16.1 (ELDK4.1). > > 2.1.0: http://mirror.switch.ch/ftp/mirror/eldk/2.1.0/eldk-mips-linux-x86/README.html > 3.0: (N/A for MIPS?) > 3.1: http://mirror.switch.ch/ftp/mirror/eldk/3.1/mips-linux-x86/distribution/README.html > 3.1.1: http://mirror.switch.ch/ftp/mirror/eldk/3.1.1/mips-linux-x86/distribution/README.html > 4.0: http://mirror.switch.ch/ftp/mirror/eldk/4.0/mips-linux-x86/distribution/README.html > http://www.denx.de/en/News/PressReleaseELDK40 > 4.1: http://mirror.switch.ch/ftp/mirror/eldk/4.1/mips-linux-x86/distribution/README.html > http://www.denx.de/en/News/PressReleaseELDK41 > 4.2: (N/A for MIPS?) > > Does above change break any builds with older binutils? Personally, I'm > ok with dropping older toolchains to some extent. However, if it breaks > builds with older toolchains, strictly speaking older versions of the > ELDK releases, the decision is up to Wolfgang. I did some researching and testing with ELDK-4.1, ELDK-4.0 and ELDK-3.1.1. In ELDK-3.1.1 we have: - mips_4KC-gcc (GCC) 3.3.3 (DENX ELDK 3.1.1 3.3.3-9) - GNU assembler 2.14 20030612 Therefore mips32r2 is already supported. But there is another problem with this binutils version. The latest additions to mips.lds and u-boot.lds for supporting recent binutils are causing parse errors. Thus ELDK-3.1.1 and earlier are not functional with mainline U-Boot anyway. ELDK-4.0 and 4.1 with gcc-4.0.0 and binutils-2.16.1 are working properly. I suggest to drop official support for ELDK-3.1.1 / binutils-2.14 and earlier. Best regards Daniel
On 03/21/2011 09:42 PM, Daniel Schwierzeck wrote: > I did some researching and testing with ELDK-4.1, ELDK-4.0 and ELDK-3.1.1. Thanks, much appreciated. > In ELDK-3.1.1 we have: > - mips_4KC-gcc (GCC) 3.3.3 (DENX ELDK 3.1.1 3.3.3-9) > - GNU assembler 2.14 20030612 > > Therefore mips32r2 is already supported. But there is another problem > with this binutils version. The latest additions to mips.lds and > u-boot.lds for supporting recent binutils are causing parse errors. I wonder what's that 'the latest additions to mips.lds and u-boot.lds for supporting recent binutils' to be exact. Which commit(s) are you referring to? Or could you provide error logs just in case please? > Thus ELDK-3.1.1 and earlier are not functional with mainline U-Boot > anyway. ELDK-4.0 and 4.1 with gcc-4.0.0 and binutils-2.16.1 are > working properly. > > I suggest to drop official support for ELDK-3.1.1 / binutils-2.14 and > earlier. Hmm. According to the README file, even the Linux kernel still builds with at least gcc 3.2. I'm feeling that it might be a bit too early to drop gcc 3.3.3 (ELDK-3.1.1). So I'd like to take a look at the issue you found this time, first. If it's easy to fix, let's fix it. And if not, revise the patch please. We have not heard of any problem reports on MIPS builds with ELDK-3.1.1 so far (at least I'm not aware of them). The change won't be a problem.
2011/3/23 Shinya Kuribayashi <skuribay@pobox.com>: > On 03/21/2011 09:42 PM, Daniel Schwierzeck wrote: >> I did some researching and testing with ELDK-4.1, ELDK-4.0 and ELDK-3.1.1. > > Thanks, much appreciated. > >> In ELDK-3.1.1 we have: >> - mips_4KC-gcc (GCC) 3.3.3 (DENX ELDK 3.1.1 3.3.3-9) >> - GNU assembler 2.14 20030612 >> >> Therefore mips32r2 is already supported. But there is another problem >> with this binutils version. The latest additions to mips.lds and >> u-boot.lds for supporting recent binutils are causing parse errors. > > I wonder what's that 'the latest additions to mips.lds and u-boot.lds > for supporting recent binutils' to be exact. Which commit(s) are you > referring to? Or could you provide error logs just in case please? Following changes have been introduced to ld in binutils-2.16: * Added SORT_BY_NAME and SORT_BY_ALIGNMENT to the linker script language to permit sorting sections by section name or section maximum alignment. http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/ld/NEWS?rev=1.116&content-type=text/plain&cvsroot=src&only_with_tag=binutils-binutils-2_21 These new macros are used in mips.lds and all u-boot.lds files. I get follogwing error with ELDK-3.1.1 or other gcc-3.x based toolchains (IncaIP used as sample config): mips_4KC-ld -g -Ttext 0x80200000 -T mips.lds \ -o <snip>/u-boot-git//build/incaip/examples/standalone/hello_world -e hello_world <snip>/u-boot-git//build/incaip/examples/standalone/hello_world.o <snip>/u-boot-git//build/incaip/examples/standalone/libstubs.o \ -L<snip>/eldk-3.11/usr/bin/../lib/gcc-lib/mips-linux/3.3.3 -lgcc mips_4KC-ld:mips.lds:37: parse error This error refers to following line: .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } Following commit introduced that change for all u-boot.lds files: http://git.denx.de/?p=u-boot.git;a=commit;h=f62fb99941c625605aa16a0097b396a5c16d2c88 I'd claim that all toolchains with binutils lesser than 2.16 are not working anymore. > >> Thus ELDK-3.1.1 and earlier are not functional with mainline U-Boot >> anyway. ELDK-4.0 and 4.1 with gcc-4.0.0 and binutils-2.16.1 are >> working properly. >> >> I suggest to drop official support for ELDK-3.1.1 / binutils-2.14 and >> earlier. > > Hmm. According to the README file, even the Linux kernel still builds > with at least gcc 3.2. I'm feeling that it might be a bit too early to > drop gcc 3.3.3 (ELDK-3.1.1). > > So I'd like to take a look at the issue you found this time, first. If > it's easy to fix, let's fix it. And if not, revise the patch please. > We have not heard of any problem reports on MIPS builds with ELDK-3.1.1 > so far (at least I'm not aware of them). The change won't be a problem. I have prepared a v3 of this patch that checks whether -mips32r2 is supported. If not than -mips32 will be used as fallback. But I want to clarify this first before I send it. Best regards, Daniel
Sorry for being late, On 03/24/2011 01:37 AM, Daniel Schwierzeck wrote: > 2011/3/23 Shinya Kuribayashi <skuribay@pobox.com>: > Following changes have been introduced to ld in binutils-2.16: [...] > I'd claim that all toolchains with binutils lesser than 2.16 are not > working anymore. [...] >>> I suggest to drop official support for ELDK-3.1.1 / binutils-2.14 and >>> earlier. Excellent, no comments from me. Let's forget about all pre-binutils 2.16 releases from now on, and ELDK-3.1.1 as well. > I have prepared a v3 of this patch that checks whether -mips32r2 is > supported. If not than -mips32 will be used as fallback. But I want > to clarify this first before I send it. I'm guessting you're worried that the corresponding line will differ from what the Linux/MIPS has, but that's not a problem. The Linux/MIPS tries to tighten the condition in accordance with explicit configuration options such as CONFIG_CPU_MIPS32_R1/R2, CONFIG_CPU_MIPS64_R1/R2. > cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ > -Wa,-mips32 -Wa,--trap > cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ > -Wa,-mips32r2 -Wa,--trap > cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ > -Wa,-mips64 -Wa,--trap > cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ > -Wa,-mips64r2 -Wa,--trap We U-Boot doesn't have to follow this convention, and can relax the cc- option rules. I'll wait for v3 patch(es), and push them during the next merge window. Thanks in advance,
2011/3/28 Shinya Kuribayashi <skuribay@pobox.com>: > Sorry for being late, No problem > > On 03/24/2011 01:37 AM, Daniel Schwierzeck wrote: >> 2011/3/23 Shinya Kuribayashi <skuribay@pobox.com>: >> Following changes have been introduced to ld in binutils-2.16: > [...] >> I'd claim that all toolchains with binutils lesser than 2.16 are not >> working anymore. > [...] >>>> I suggest to drop official support for ELDK-3.1.1 / binutils-2.14 and >>>> earlier. > > Excellent, no comments from me. Let's forget about all pre-binutils > 2.16 releases from now on, and ELDK-3.1.1 as well. > >> I have prepared a v3 of this patch that checks whether -mips32r2 is >> supported. If not than -mips32 will be used as fallback. But I want >> to clarify this first before I send it. > > I'm guessting you're worried that the corresponding line will differ > from what the Linux/MIPS has, but that's not a problem. The Linux/MIPS > tries to tighten the condition in accordance with explicit configuration > options such as CONFIG_CPU_MIPS32_R1/R2, CONFIG_CPU_MIPS64_R1/R2. > >> cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ >> -Wa,-mips32 -Wa,--trap >> cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ >> -Wa,-mips32r2 -Wa,--trap >> cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ >> -Wa,-mips64 -Wa,--trap >> cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ >> -Wa,-mips64r2 -Wa,--trap > > We U-Boot doesn't have to follow this convention, and can relax the cc- > option rules. > > I'll wait for v3 patch(es), and push them during the next merge window. > Thanks in advance, > Ok if we drop toolchain support for binutils lesser than 2.16 than I can simplify the this patch to one line because the assembler check is obsolete too: MIPSFLAGS = $(call cc-option,-march=mips32r2) Do you agree?
On 3/29/11 12:27 AM, Daniel Schwierzeck wrote: > Ok if we drop toolchain support for binutils lesser than 2.16 than I > can simplify the > this patch to one line because the assembler check is obsolete too: > > MIPSFLAGS = $(call cc-option,-march=mips32r2) > > Do you agree? It sounds you're misunderstanding how cc-option works. Could you take a look at $(TOPDIR)/config.mk again?
2011/3/28 Shinya Kuribayashi <skuribay@pobox.com>: > On 3/29/11 12:27 AM, Daniel Schwierzeck wrote: >> >> Ok if we drop toolchain support for binutils lesser than 2.16 than I >> can simplify the >> this patch to one line because the assembler check is obsolete too: >> >> MIPSFLAGS = $(call cc-option,-march=mips32r2) >> >> Do you agree? > > It sounds you're misunderstanding how cc-option works. Could you take > a look at $(TOPDIR)/config.mk again? > Actually not. But you're right, cc-option is not needed ;)
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk index a173c54..a91dcb4 100644 --- a/arch/mips/cpu/mips32/config.mk +++ b/arch/mips/cpu/mips32/config.mk @@ -20,20 +20,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2) -MIPSFLAGS:=$(shell \ -if [ "$v" -lt "14" ]; then \ - echo "-mcpu=4kc"; \ -else \ - echo "-march=4kc -mtune=4kc"; \ -fi) -ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) -ENDIANNESS = -EL -else -ENDIANNESS = -EB -endif +# Optimization flags for all Mips32 CPUs +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2) -MIPSFLAGS += $(ENDIANNESS) +# Determine endianess from toolchain prefix +ENDIANESS = $(shell $(CC) -dumpmachine | \ + grep -q 'mips.*el-.*' && echo -EL || echo -EB) + +PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANESS) -PLATFORM_CPPFLAGS += $(MIPSFLAGS)
The current Mips CPU config.mk code always expects a Mips 4kc core and toolchain. This is not appropiate for other toolchains and CPUs/SoCs. Replace the current MIPSFLAGS code by cc-option macro and use -march=mips32r2 as default optimization level for all Mips32 CPUs. Replace the endianess determination code from toolchain prefix by a more generic one inspired by the Linux arch/mips/Makefile. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com> Cc: Shinya Kuribayashi <skuribay@pobox.com> Cc: Wolfgang Denk <wd@denx.de> --- arch/mips/cpu/mips32/config.mk | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) -- 1.7.4.1