From: Shinya Kuribayashi <skuribay@pobox.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] mips: unify lds
Date: Sat, 16 May 2009 12:59:28 +0900 [thread overview]
Message-ID: <4A0E3A20.5010900@pobox.com> (raw)
In-Reply-To: <20090510213454.A9AB9832E416@gemini.denx.de>
Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
>
> In message <1241989002-21623-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
>> all mips boards except a few use the same cpu lds so move it to cpu/$(CPU)
>>
>> that could be overwrite in following order
>> SOC
>> BOARD
>> via the corresponding config.mk
>>
>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>> Cc: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
I've double checked that consolidation of u-boot.lds files is ok, and
LDSCRIPT part as wll.
>> diff --git a/Makefile b/Makefile
>> index ee09856..2cb0ce2 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -3222,6 +3222,7 @@ dbau1550_config : unconfig
>> dbau1550_el_config : unconfig
>> @mkdir -p $(obj)include
>> @echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h
>> + @echo "#define CONFIG_CPU_LITTLE_ENDIAN" >>$(obj)include/config.h
>> @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
>>
>> gth2_config : unconfig
>> @@ -3232,6 +3233,7 @@ gth2_config : unconfig
>> pb1000_config : unconfig
>> @mkdir -p $(obj)include
>> @echo "#define CONFIG_PB1000 1" >$(obj)include/config.h
>> + @echo "#define CONFIG_CPU_LITTLE_ENDIAN" >>$(obj)include/config.h
>> @$(MKCONFIG) -a pb1x00 mips mips pb1x00
>
> These changes look unrelated to the linker script stuff you mention in
> the commit message ? If they are related, you should explain what you
> are doing here, and why.
This tweaks little endian builds, and used with mips_config.mk change.
+ifdef CONFIG_CPU_LITTLE_ENDIAN
+PREDEF +=-DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
+PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(UNDEF_ALL) $(PREDEF))
+else
+PREDEF += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__
+PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(UNDEF_ALL) $(PREDEF))
+endif
Background is, we're going to have a single, unified u-boot.lds, hence
OUTPUT_FORMAT(default, big, little) command would be applied across all
supported targets as well. Then, we'd like to pass -EL specifier to the
linker so that some little-endian builds are processed properly.
The goal here is,
* Explicitly add the endianness specifier _if_needed_, this allows
to compile kernels with a toolchain for the other endianness.
* We carefully avoid to add it redundantly because gcc 3.3/3.4
complains when fed the toolchain default!
* Expected behavior
# echo mips-linux | grep -q 'mips.*el-.*' || echo -EL
-EL
# echo mips-linux | grep -q 'mips.*el-.*' && echo -EB
# echo mipsel-linux | grep -q 'mips.*el-.*' || echo -EL
# echo mipsel-linux | grep -q 'mips.*el-.*' && echo -EB
-EB
* Side-effects
Some LE toolchains with 'mips-linux', will have a redundant -LE.
Some BE toolchains with 'mipsel-linux', will have a redundant -BE.
In these cases, you would see a lot of warnings. It's harmless, so
I'd like to ignore them as they're minor enough, and consolidation
of lds files is more important here. Also note that I believe we
would never find the latter case.
So, I'd like to say the patch itself looks basically good.
But still some work needs to be done.
* How about splitting the patch into two, 1) CONFIG_CPU_LITTLE_ENDIAN
introduction patch, and 2) u-boot.lds consoliation patch ?
* Just wondered, is there any reason why you didn't use PREDEF_{BE,LE}
like Linux kernel does?
UNDEF_ALL += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__
UNDEF_ALL += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__
>>PREDEF_BE += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__<<
>>PREDEF_LE += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__<<
ifdef CONFIG_CPU_LITTLE_ENDIAN
PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(UNDEF_ALL) $(PREDEF_LE))
else
PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(UNDEF_ALL) $(PREDEF_BE))
endif
* By the way, s/PLATFORM_CFLAGS/PLATFORM_CPPFLAGS/.
* And we need -EL/-EB specifier on PLATFORM_LDFLAGS as well.
We call the GNU ld directly on the final link, so $(UNDEF_ALL) and
$(PREDEF_??) part probably are not required.
* We need to fix examples/{Makefile,mips.lds} as well.
* We need to remove ENDIANNESS from cpu/mips/config.mk, finally.
diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk
index a173c54..098d6c7 100644
--- a/cpu/mips/config.mk
+++ b/cpu/mips/config.mk
@@ -28,12 +28,4 @@ else \
echo "-march=4kc -mtune=4kc"; \
fi)
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
-endif
-
-MIPSFLAGS += $(ENDIANNESS)
-
PLATFORM_CPPFLAGS += $(MIPSFLAGS)
If there're any problems or objections, I'll work on the patch on my
side (to help Jean), and try to queue them toward the next release.
Revised patches are welcome, of course.
Shinya
next prev parent reply other threads:[~2009-05-16 3:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-10 20:56 [U-Boot] [PATCH 1/1] mips: unify lds Jean-Christophe PLAGNIOL-VILLARD
2009-05-10 21:34 ` Wolfgang Denk
2009-05-16 3:59 ` Shinya Kuribayashi [this message]
2009-05-16 4:02 ` Shinya Kuribayashi
2009-05-22 23:48 ` [U-Boot] *** PROBABLY SPAM *** " Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 11:35 ` [U-Boot] [PATCH 1/2 V2] mips: add endianness support Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 11:35 ` [U-Boot] [PATCH 2/2 V2] mips: unify lds Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 15:45 ` Shinya Kuribayashi
2009-05-23 15:24 ` [U-Boot] [PATCH 1/2 V2] mips: add endianness support Shinya Kuribayashi
2009-05-23 15:19 ` Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 17:58 ` Shinya Kuribayashi
2009-05-23 19:41 ` Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 19:42 ` [U-Boot] [PATCH 1/3] fix: missing autoconfig.mk from general Makefile Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 19:42 ` [U-Boot] [PATCH 2/3] mips: add endianness support Jean-Christophe PLAGNIOL-VILLARD
2009-05-23 19:42 ` [U-Boot] [PATCH 3/3] mips: unify lds Jean-Christophe PLAGNIOL-VILLARD
2009-05-31 22:27 ` Wolfgang Denk
2009-05-31 22:26 ` [U-Boot] [PATCH 2/3] mips: add endianness support Wolfgang Denk
2009-05-23 22:28 ` [U-Boot] [PATCH 1/3] fix: missing autoconfig.mk from general Makefile Wolfgang Denk
2009-05-24 15:18 ` Jean-Christophe PLAGNIOL-VILLARD
2009-05-24 17:13 ` Wolfgang Denk
2009-06-23 14:34 ` Shinya Kuribayashi
2009-06-23 15:14 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-23 15:40 ` Shinya Kuribayashi
2009-06-23 21:26 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-23 17:07 ` Mike Frysinger
2009-06-23 17:33 ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-10 22:35 ` Wolfgang Denk
2009-07-11 3:18 ` Mike Frysinger
2009-07-17 19:18 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A0E3A20.5010900@pobox.com \
--to=skuribay@pobox.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox