public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
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: Wed, 22 Sep 2010 21:07:57 +0200	[thread overview]
Message-ID: <4C9A540D.3020205@free.fr> (raw)
In-Reply-To: <AANLkTinK1PWePkBaBHEnxcyV6eOwtjZb-7+kA-JhHM9Z@mail.gmail.com>

Le 22/09/2010 20:05, Ben Gardiner a ?crit :
> Bonjour Albert,

:) Hi Ben,

> On Wed, Sep 22, 2010 at 9:57 AM, Albert Aribaud<albert.aribaud@free.fr>  wrote:
>> Add -msingle-pic-base to the relocation flags, and compute the pic base
>> in start.S twice and for all -- once before relocation to run board_init_f,
>> and once after relocation to run board_init_r and the rest of u-boot.
>> This further reduces code size by 2.5% compared to -fPIE alone.
>>
>> Signed-off-by: Albert Aribaud<albert.aribaud@free.fr>
>
> I tried tested this on da850evm -- the da850evm.h has "#undef
> CONFIG_SYS_ARM_WITHOUT_RELOC /* This board is tested with relocation
> support */".
>
> I never got a boot-prompt. I tried mucking with the patch a little and
> found that if I did:
>
> 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
>   # =========================================================================
>   #
>
> Then I do get a prompt.
>
> The gcc version here is:
> $arm-none-linux-gnueabi-gcc --version
> arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
> Copyright (C) 2008 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> I have a JTAG debugger for this board. Please let me know if there are
> register dumps or the like that I can get you.
>
> Best Regards,
> Ben Gardiner

Basically your test seems to demonstrate show that the pic base value 
computed in start.S does not work for board_init_f.

Did you execute the binary at the address specified in TEXT_BASE? If 
not, please adjust TEXT_BASE to the location where u-boot resides when 
you debug it.

Otherwise, can you do the following? This will help me see if the pic 
base computed in start.S is the same as the one computed by each 
function without -msingle-pic-base.

1) build with your fix in;

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;

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;

4) compare values found in 2 and 3 with the value of __got_base in the 
.map file.

5) Report your findings here. :)

Thanks for your help!

Amicalement,
-- 
Albert.

  reply	other threads:[~2010-09-22 19:07 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 [this message]
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
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=4C9A540D.3020205@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