Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-21 Thread Albert ARIBAUD
On Tue, 11 Jun 2013 14:17:29 +0200, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:

 This series optimizes relocation by ensuring ARM
 binaries only use one type of relocation record,
 R_ARM_RELATIVE., then optimizing relocation code
 accordingly.
 
 1. A Makefile rule is added that checks that no
 other relocation record types are generated except
 R_ARM_RELATIVE; build fails if this is the case.
 
 2. All references to dymsym are removed, as this
 table is not used for R_ARM_RELATIVE relocations.
 
 3. arch/arm/lib/bss.c is replaced by a more generic
 arch/arm/lib/sections.c where all section symbols will
 be defined.
 
 4. __image_copy_start and __image_copy_end symbols
 are moved from linker scripts to arch/arm/lib/sections.c
 
 5. __rel_dyn_start and __rel_dyn_end are moved from
 linker scripts into arch/arm/lib/sections.c
 
 6. relocate_code is optimized based on the fact that
 symbol references are now always valid even before
 relcation, and that only R_ARM_RELATIVE relocations
 will be met.
 
 Changes in v3:
 - fix commit message typo (of - if)
 - fix commit message typo (breaks - break)
 
 Changes in v2:
 - use $ instead of $(obj)u-boot
 - new in V2: remove all dynsym references
 - various comment fixes
 
 Albert ARIBAUD (6):
   arm: ensure u-boot only uses relative relocations
   remove all references to .dynsym
   arm: generalize lib/bss.c into lib/sections.c
   arm: make __image_copy_{start,end} compiler-generated
   arm: make __rel_dyn_{start,end} compiler-generated
   arm: optimize relocate_code routine
 
  Makefile   |7 +++
  arch/arm/config.mk |5 ++
  arch/arm/cpu/arm920t/ep93xx/u-boot.lds |6 ++-
  arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds  |5 --
  arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds|5 --
  arch/arm/cpu/ixp/u-boot.lds|   20 +---
  arch/arm/cpu/u-boot-spl.lds|6 +--
  arch/arm/cpu/u-boot.lds|   21 +---
  arch/arm/lib/Makefile  |2 +-
  arch/arm/lib/relocate.S|   61 
 ++--
  arch/arm/lib/{bss.c = sections.c} |8 +++-
  board/actux1/u-boot.lds|   20 +---
  board/actux2/u-boot.lds|   20 +---
  board/actux3/u-boot.lds|   20 +---
  board/ait/cam_enc_4xx/u-boot-spl.lds   |5 --
  board/davinci/da8xxevm/u-boot-spl-da850evm.lds |5 --
  board/davinci/da8xxevm/u-boot-spl-hawk.lds |1 -
  board/dvlhost/u-boot.lds   |   20 +---
  board/freescale/mx31ads/u-boot.lds |   20 +---
  board/vpac270/u-boot-spl.lds   |6 +--
  include/asm-generic/sections.h |3 --
  21 files changed, 139 insertions(+), 127 deletions(-)
  rename arch/arm/lib/{bss.c = sections.c} (79%)
 

Applied to u-boot-arm/master.

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-18 Thread Albert ARIBAUD
Hi Jeroen,

On Sun, 16 Jun 2013 15:33:32 +0200, Jeroen Hofstee
jer...@myspectrum.nl wrote:

 Hello Albert,
 
 On 06/13/2013 08:54 PM, Jeroen Hofstee wrote:
 
  binaries only use one type of relocation record,
  R_ARM_RELATIVE., then optimizing relocation code
  accordingly.
 
 
 
 fyi, I had a look at the clang build and it doesn't boot
 after these patches...
 
 When constant pointers are used without fpie, e.g. the
 arguments to printf, gcc will load the address with ldr /
 R_ARM_ABS32, clang sets the address with a movw /
 movt pair.

Hmm... Why do you remove -fpie from the gcc build?

 ld -r will make the former relative, but the movw / movt
 cannot be fixed. So I set fpie for clang, which generates
 a couple of R_ARM_ABS32:
 
 Most notably a reference to do_bootd. Since it is no
 longer valid after this patch and used in command.c this
 crashes the board (unless there happens to be a valid
 address in it). gcc seems to always recalculate it using pc.
 
 Another symbol is _start, but that looks easily fixable.
 
 The last one looks similar like the do_bootd and I haven't
 bothered to check the details.

Can you give more precise info on the issue? Such as the U-Boot
codebase (even if not in shape for submitting) and clang compiler
version you are using, so that I can try the build on my side and have
a look at how/why r_arm_abs32 relocation recodes are generated and how
to avoid it?

 Regards,
 Jeroen

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-16 Thread Jeroen Hofstee

Hello Albert,

On 06/13/2013 08:54 PM, Jeroen Hofstee wrote:



binaries only use one type of relocation record,
R_ARM_RELATIVE., then optimizing relocation code
accordingly.






fyi, I had a look at the clang build and it doesn't boot
after these patches...

When constant pointers are used without fpie, e.g. the
arguments to printf, gcc will load the address with ldr /
R_ARM_ABS32, clang sets the address with a movw /
movt pair.

ld -r will make the former relative, but the movw / movt
cannot be fixed. So I set fpie for clang, which generates
a couple of R_ARM_ABS32:

Most notably a reference to do_bootd. Since it is no
longer valid after this patch and used in command.c this
crashes the board (unless there happens to be a valid
address in it). gcc seems to always recalculate it using pc.

Another symbol is _start, but that looks easily fixable.

The last one looks similar like the do_bootd and I haven't
bothered to check the details.

Regards,
Jeroen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-13 Thread Albert ARIBAUD
Hi Albert,

On Tue, 11 Jun 2013 14:47:29 +0200, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:

 Hi Albert,
 
 On Tue, 11 Jun 2013 14:17:29 +0200, Albert ARIBAUD
 albert.u.b...@aribaud.net wrote:
 
  This series optimizes relocation by ensuring ARM
  binaries only use one type of relocation record,
  R_ARM_RELATIVE., then optimizing relocation code
  accordingly.
 
 This is a cosmetic version only; if no one complains loudly, this
 will be the final version too.
 
 So people, as this touches ARM relocation, I would appreciate it if a
 few people could test it on their own ARM HW target and see if they
 still get a prompt, if command completion still works, etc.

Lubo has tested on a custom ARM board, my thanks to him.

Anyone else would be so kind as to do a quick test on their ARM boards?

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-13 Thread Jeroen Hofstee

On 06/13/2013 11:05 AM, Albert ARIBAUD wrote:

Hi Albert,

On Tue, 11 Jun 2013 14:47:29 +0200, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:


Hi Albert,

On Tue, 11 Jun 2013 14:17:29 +0200, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:


This series optimizes relocation by ensuring ARM
binaries only use one type of relocation record,
R_ARM_RELATIVE., then optimizing relocation code
accordingly.

This is a cosmetic version only; if no one complains loudly, this
will be the final version too.

So people, as this touches ARM relocation, I would appreciate it if a
few people could test it on their own ARM HW target and see if they
still get a prompt, if command completion still works, etc.

Lubo has tested on a custom ARM board, my thanks to him.

Anyone else would be so kind as to do a quick test on their ARM boards?

Amicalement,

Tested-by: Jeroen Hofstee jer...@myspectrum.nl

arm-master + these patches on a twister (am3517) with
gcc / Linaro 4.7.2. Will have a look at clang.

Regards,
Jeroen



am35
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-12 Thread Benoît Thébaudeau
Hi Albert,

On Tuesday, June 11, 2013 2:17:29 PM, Albert ARIBAUD wrote:
 This series optimizes relocation by ensuring ARM
 binaries only use one type of relocation record,
 R_ARM_RELATIVE., then optimizing relocation code
 accordingly.
 
 1. A Makefile rule is added that checks that no
 other relocation record types are generated except
 R_ARM_RELATIVE; build fails if this is the case.
 
 2. All references to dymsym are removed, as this
 table is not used for R_ARM_RELATIVE relocations.
 
 3. arch/arm/lib/bss.c is replaced by a more generic
 arch/arm/lib/sections.c where all section symbols will
 be defined.
 
 4. __image_copy_start and __image_copy_end symbols
 are moved from linker scripts to arch/arm/lib/sections.c
 
 5. __rel_dyn_start and __rel_dyn_end are moved from
 linker scripts into arch/arm/lib/sections.c
 
 6. relocate_code is optimized based on the fact that
 symbol references are now always valid even before
 relcation, and that only R_ARM_RELATIVE relocations
 will be met.
 
 Changes in v3:
 - fix commit message typo (of - if)
 - fix commit message typo (breaks - break)

For this v3 series:
Reviewed-by: Benoît Thébaudeau benoit.thebaud...@advansee.com

Best regards,
Benoît
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-11 Thread Albert ARIBAUD
Hi Albert,

On Tue, 11 Jun 2013 14:17:29 +0200, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:

 This series optimizes relocation by ensuring ARM
 binaries only use one type of relocation record,
 R_ARM_RELATIVE., then optimizing relocation code
 accordingly.

This is a cosmetic version only; if no one complains loudly, this
will be the final version too.

So people, as this touches ARM relocation, I would appreciate it if a
few people could test it on their own ARM HW target and see if they
still get a prompt, if command completion still works, etc.

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-11 Thread Lubomir Popov
Hi Albert,

On 11/06/13 15:47, Albert ARIBAUD wrote:
 Hi Albert,
 
 On Tue, 11 Jun 2013 14:17:29 +0200, Albert ARIBAUD
 albert.u.b...@aribaud.net wrote:
 
 This series optimizes relocation by ensuring ARM
 binaries only use one type of relocation record,
 R_ARM_RELATIVE., then optimizing relocation code
 accordingly.
 
 This is a cosmetic version only; if no one complains loudly, this
 will be the final version too.
 
 So people, as this touches ARM relocation, I would appreciate it if a
 few people could test it on their own ARM HW target and see if they
 still get a prompt, if command completion still works, etc.

Applied the series to a relatively fresh (yesterday's) u-boot-ti/master
and tested on a custom OMAP5430 board. Boots normally. USB storage and
Ethernet (dhcp  ping), SD/MMC, I2C are all working.

Tested-by: Lubomir Popov lpo...@mm-sol.com

Regards,
Lubo
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/6] Optimize ARM relocation

2013-06-11 Thread Albert ARIBAUD
Hi Lubomir,

On Tue, 11 Jun 2013 17:22:17 +0300, Lubomir Popov lpo...@mm-sol.com
wrote:

 Hi Albert,

 Applied the series to a relatively fresh (yesterday's) u-boot-ti/master
 and tested on a custom OMAP5430 board. Boots normally. USB storage and
 Ethernet (dhcp  ping), SD/MMC, I2C are all working.
 
 Tested-by: Lubomir Popov lpo...@mm-sol.com

Thanks a lot!

 Regards,
 Lubo

Amicalement,
-- 
Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot