From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] [NEXT] arm926ejs: reduce code size with -msingle-pic-base
Date: Thu, 23 Sep 2010 19:04:57 +0200 [thread overview]
Message-ID: <4C9B88B9.3060702@free.fr> (raw)
In-Reply-To: <AANLkTimxhwaUbauQYfnGA+un3Pma8k6mhMEw7iDsZvkR@mail.gmail.com>
Le 23/09/2010 18:37, Ben Gardiner a ?crit :
> On Wed, Sep 22, 2010 at 3:07 PM, Albert ARIBAUD<albert.aribaud@free.fr> wrote:
>> 1) build with your fix in;
>
> $git log --format=oneline|head -n 3
> f619c1537af105cd1471f9447ac9132feab79c3a arm926ejs: reduce code size
> with -msingle-pic-base
> 6285f63589a87dfd28c7d73ff68075c5d1ee7f35 arm: change relocation flag
> from -fPIC to -fPIE
> e69e520f9d235bb7d96296081fdfc09b9fee8c46 fsl: refactor MPC8610 and
> MPC5121 DIU code to use existing bitmap and logo features
>
> $git diff
> diff --git a/arch/arm/cpu/arm926ejs/config.mk b/arch/arm/cpu/arm926ejs/config.mk
> index aa84706..f8ef90f 100644
> --- a/arch/arm/cpu/arm926ejs/config.mk
> +++ b/arch/arm/cpu/arm926ejs/config.mk
> @@ -23,11 +23,6 @@
>
> PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
>
> -ifndef CONFIG_SYS_ARM_WITHOUT_RELOC
> -# needed for optimal relocation
> -PLATFORM_RELFLAGS += -msingle-pic-base
> -endif
> -
> PLATFORM_CPPFLAGS += -march=armv5te
> # =========================================================================
> #
>
> $make mrproper; make da850evm_config; make -j9 all
> [...]
> make[1]: Entering directory `[...]arch/arm/lib'
> arm-none-linux-gnueabi-gcc -g -Os -fPIE -fno-common -ffixed-r8
> -msoft-float -fno-common -ffixed-r8 -msoft-float -D__KERNEL__
> -DTEXT_BASE=0xC1080000 -I[...]/include -fno-builtin -ffreestanding
> -nostdinc -isystem
> /opt/codesourcery-arm-none-eabi-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include
> -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux
> -mno-thumb-interwork -march=armv5te -march=armv5te -Wall
> -Wstrict-prototypes -fno-stack-protector \
> -o board.o board.c -c
> [...]
>
>> 2) debug (at the assembly instruction level) the start.S code and see what
>> value ends up in r10 (aka sl) right before calling board_init_f;
>
> (gdb) p /x $r10
> $1 = 0xc1098564
> (gdb) p /x $pc
> $2 = 0xc1080088
>
>> 3) proceed (still at the assembly instruction level) until you get within
>> board_init_f. Among the first instructions will be the recomputation of
>> 10/sl; see what value it is assigned;
>
> (gdb) p /x $r10
> $5 = 0xc1098564
> (gdb) p /x $pc
> $6 = 0xc1080694
> (gdb)
>
>> 4) compare values found in 2 and 3 with the value of __got_base in the .map
>> file.
>
> $cat System.map |grep __got_base
> c1098564 A __got_base
>
> I hope that helps.
Well, it confirms that the start.S code computes a correct r10 / sl
register, since it is the same value as board_init_f (and any other
function) computes when -msingle-pic-base is not present, and this value
is that of __got_base.
Note that if I'm not mistaken, your build uses r9 as the pic base, not
10 -- this is a possibility, and my patches are written so as to allow
either register use.
Now, we need to find out why board_init_f fails to go through the init
sequence and print out at least the banner and some diagnostics.
Please build with my two patches alone (i.e., put -msingle-pic-base back
in place, which will remove the recomputation of the pic base in every
function), and run it until board_init_f() calls its first init function
through (*init_fnc_ptr)(). This call should be materialized by a 'blx
<reg>' instruction; please report the value of <reg> at that point as
well as the addresses of arch_cpu_init, board_early_init_f, and
timer_init; <reg> should be one of these depending on the board config.
> Best Regards,
> Ben Gardiner
Thanks again for your help in testing my patches!
Amicalement,
--
Albert.
next prev parent reply other threads:[~2010-09-23 17:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 13:57 [U-Boot] [PATCH 1/2] [NEXT] arm: change relocation flag from -fPIC to -fPIE Albert Aribaud
2010-09-22 13:57 ` [U-Boot] [PATCH 2/2] [NEXT] arm926ejs: reduce code size with -msingle-pic-base Albert Aribaud
2010-09-22 18:05 ` Ben Gardiner
2010-09-22 19:07 ` Albert ARIBAUD
2010-09-22 20:51 ` Ben Gardiner
2010-09-22 21:36 ` Albert ARIBAUD
2010-09-22 22:07 ` Albert ARIBAUD
2010-09-23 14:44 ` Ben Gardiner
2010-09-23 15:13 ` Albert ARIBAUD
2010-09-23 15:35 ` Ben Gardiner
2010-09-23 16:53 ` Ben Gardiner
2010-09-23 16:37 ` Ben Gardiner
2010-09-23 17:04 ` Albert ARIBAUD [this message]
2010-09-23 21:13 ` Ben Gardiner
2010-09-23 21:30 ` Albert ARIBAUD
2010-09-24 13:38 ` Ben Gardiner
2010-09-24 16:08 ` Albert ARIBAUD
2010-09-22 20:30 ` Wolfgang Denk
2010-09-22 20:55 ` Ben Gardiner
2010-09-22 21:11 ` Wolfgang Denk
2010-09-22 21:33 ` Ben Gardiner
2010-09-23 7:12 ` Heiko Schocher
2010-09-23 8:05 ` Albert ARIBAUD
2010-09-23 10:08 ` Heiko Schocher
2010-09-23 12:45 ` Albert ARIBAUD
2010-09-24 5:11 ` Heiko Schocher
2010-09-24 5:47 ` Albert ARIBAUD
2010-09-24 16:45 ` Rogan Dawes
2010-09-24 16:58 ` Rogan Dawes
2010-09-24 17:13 ` Albert ARIBAUD
2010-09-22 18:05 ` [U-Boot] [PATCH 1/2] [NEXT] arm: change relocation flag from -fPIC to -fPIE Ben Gardiner
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=4C9B88B9.3060702@free.fr \
--to=albert.aribaud@free.fr \
--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