.globl _TEXT_BASE
  _TEXT_BASE:
 -      .word   TEXT_BASE
 +      .word   CONFIG_SYS_TEXT_BASE
  
- #if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
- .globl _armboot_start
- _armboot_start:
-       .word _start
- #endif
- 
  /*
   * These are defined in the board-specific linker script.
+  * Subtracting _start from them lets the linker put their
+  * relative position in the executable instead of leaving
+  * them null.
   */
- .globl _bss_start
- _bss_start:
-       .word __bss_start
- 
- .globl _bss_end
- _bss_end:
-       .word _end
- 
- #if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
- .globl _datarel_start
- _datarel_start:
-       .word __datarel_start
+ .globl _bss_start_ofs
+ _bss_start_ofs:
+       .word __bss_start - _start
  
- .globl _datarelrolocal_start
- _datarelrolocal_start:
-       .word __datarelrolocal_start
+ .globl _bss_end_ofs
+ _bss_end_ofs:
+       .word _end - _start
  
- .globl _datarellocal_start
- _datarellocal_start:
-       .word __datarellocal_start
+ .globl _datarel_start_ofs
+ _datarel_start_ofs:
+       .word __datarel_start - _start
  
- .globl _datarelro_start
- _datarelro_start:
-       .word __datarelro_start
+ .globl _datarelrolocal_start_ofs
+ _datarelrolocal_start_ofs:
+       .word __datarelrolocal_start - _start
  
- .globl _got_start
- _got_start:
-       .word __got_start
+ .globl _datarellocal_start_ofs
+ _datarellocal_start_ofs:
+       .word __datarellocal_start - _start
  
- .globl _got_end
- _got_end:
-       .word __got_end
- #endif
+ .globl _datarelro_start_ofs
+ _datarelro_start_ofs:
+       .word __datarelro_start - _start
  
  #ifdef CONFIG_USE_IRQ
  /* IRQ stack memory (calculated at run-time) */
 
  To make relocation on arm working, the following changes are done:
  
- Add new compilerflag:
+ At arch level: add linker flag -pie
  
- -fPIC
+       This causes the linker to generate fixup tables .rel.dyn and .dynsym,
+       which must be applied to the relocated image before transferring
+       control to it.
  
-       -> compiler generates position independent code
+       These fixups are described in the ARM ELF documentation as type 23
+       (program-base-relative) and 2 (symbol-relative)
  
- changes in board code:
+ At cpu level: modify linker file and add a relocation and fixup loop
  
- - dram_init:
-   - bd pointer is now at this point not accessible, so only
-     detect the real dramsize, and store it in gd->ram_size.
-     best detected with get_ram_size();
-     ToDo: move there also the dram initialization on boards where
-           it is possible.
-   - setup the bd_t dram bank info in the new function
-     dram_init_banksize().
+       the linker file must be modified to include the .rel.dyn and .dynsym
+       tables in the binary image, and to provide symbols for the relocation
+       code to access these tables
  
- - board.c code is adapted from ppc code
+       The relocation and fixup loop must be executed after executing
+       board_init_f at initial location and before executing board_init_r
+       at final location.
  
- - undef CONFIG_RELOC_FIXUP_WORKS
+ At board level:
  
-   -> cmdtabl, and subcommand table must be handled from "hand"
-      collected in section "__datarellocal_start".
+       dram_init(): bd pointer is now at this point not accessible, so only
+       detect the real dramsize, and store it in gd->ram_size. Bst detected
+       with get_ram_size().
  
-   - How To fixup the sections:
+ TODO: move also dram initialization there on boards where it is possible.
  
-     __datarel_start, __datarelrolocal_start, __datarellocal_start and
-     __datarelro_start
+       Setup of the the bd_t dram bank info is done in the new function
+       dram_init_banksize() called after bd is accessible.
  
-     automatically? Then it should be possible to define again
-     CONFIG_RELOC_FIXUP_WORKS
+ At lib level:
  
- - irq stack setup is now not longer on a fix position, instead it is
-   calculated in board_init_f, and stored in gd->irq_sp
+       Board.c code is adapted from ppc code
  
- -------------------------------------------------------------------------------------
+ At config level:
  
- To compile a board without relocation, define CONFIG_SYS_ARM_WITHOUT_RELOC
- This possibility will removed!! So please fix your board to compile without
- CONFIG_SYS_ARM_WITHOUT_RELOC defined!!!
+       Define CONFIG_RELOC_FIXUP_WORKS.
+       Undefine CONFIG_SYS_ARM_WITHOUT_RELOC
  
- -------------------------------------------------------------------------------------
+ * WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING ** WARNING *
+ 
+ Boards which are not fixed to support relocation will be REMOVED!
+ 
+ Eventually, CONFIG_SYS_ARM_WITHOUT_RELOC and CONFIG_RELOC_FIXUP_WORKS will
+ disappear and boards which have to migrated to relocation will disappear too.
  
- For boards which boot from nand_spl, it is possible to save a copy
+ -----------------------------------------------------------------------------
+ 
+ For boards which boot from nand_spl, it is possible to save one copy
 -if TEXT_BASE == relocation address! This prevents that uboot code
 +if CONFIG_SYS_TEXT_BASE == relocation address! This prevents that uboot code
  is copied again in relocate_code().
  
  example for the tx25 board:
  f) u-boot code steps through board_init_f() and calculates
     the relocation address and copy itself to it
  
 -If TEXT_BASE == relocation address, the copying of u-boot
 +If CONFIG_SYS_TEXT_BASE == relocation address, the copying of u-boot
  in f) could be saved.
  
- -------------------------------------------------------------------------------------
+ -----------------------------------------------------------------------------
  
- ToDo:
+ TODO
  
  - fill in bd_t infos (check)
  - adapt all boards