[U-Boot] [PATCH 2/2] [NEXT] arm926ejs: reduce code size with -msingle-pic-base

Ben Gardiner
2010-09-23T16:37:33Z

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.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.