[U-Boot] [PATCH 2/2] [NEXT] arm926ejs: reduce code size with -msingle-pic-base
Albert ARIBAUD
albert.aribaud at free.fr
Wed Sep 22 21:07:57 CEST 2010
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 at 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 at 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.
More information about the U-Boot
mailing list