arm: remove unneeded symbol offsets and _TEXT_BASE
Subsystems (6)
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of _TEXT_BASE. Remove all _TEXT_BASE definitions.
---_TEXT_BASE was only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.
In some places, _TEXT_BASE was locally defined only to provide a literal for CONFIG_SYS_TEXT_BASE when the latter could have been used directly.
Sometimes even, _TEXT_BASE was defined but unused.
Since all relocations in ARM are relative, offsets, _TEXT_BASE and CONFIG_SYS_SYM_OFFSETS can be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols from sections.c file.
README | 6 ------ arch/arm/cpu/arm1136/start.S | 27 --------------------------- arch/arm/cpu/arm1176/start.S | 27 --------------------------- arch/arm/cpu/arm720t/start.S | 26 -------------------------- arch/arm/cpu/arm920t/start.S | 26 -------------------------- arch/arm/cpu/arm926ejs/at91/lowlevel_init.S | 14 +------------- arch/arm/cpu/arm926ejs/mxs/start.S | 27 --------------------------- arch/arm/cpu/arm926ejs/start.S | 27 --------------------------- arch/arm/cpu/arm946es/start.S | 26 -------------------------- arch/arm/cpu/arm_intcm/start.S | 26 -------------------------- arch/arm/cpu/armv7/omap3/lowlevel_init.S | 3 --- arch/arm/cpu/armv7/start.S | 23 ----------------------- arch/arm/cpu/ixp/start.S | 26 -------------------------- arch/arm/cpu/pxa/start.S | 27 --------------------------- arch/arm/cpu/sa1100/start.S | 26 -------------------------- arch/arm/lib/board.c | 12 ++++++------ board/armltd/integrator/lowlevel_init.S | 2 +- board/cm4008/flash.c | 2 +- board/cm41xx/flash.c | 2 +- board/mpl/vcma9/lowlevel_init.S | 5 +---- board/mx1ads/lowlevel_init.S | 4 ---- board/samsung/goni/lowlevel_init.S | 3 --- board/samsung/smdk2410/lowlevel_init.S | 5 +---- board/samsung/smdk5250/lowlevel_init.S | 5 +---- board/samsung/smdkc100/lowlevel_init.S | 3 --- board/ti/omap5912osk/lowlevel_init.S | 4 ---- board/ti/omap730p2/lowlevel_init.S | 3 --- common/board_f.c | 18 +++++++----------- common/board_r.c | 4 ++-- include/asm-generic/sections.h | 26 +++++++------------------- 30 files changed, 29 insertions(+), 406 deletions(-)
README +0 -6
@@ -3522,12 +3522,6 @@ Configuration Settings: its config.mk file). If you find problems enabling this option on your board please report the problem and send patches! -- CONFIG_SYS_SYM_OFFSETS - This is set by architectures that use offsets for link symbols - instead of absolute values. So bss_start is obtained using an - offset _bss_start_ofs from CONFIG_SYS_TEXT_BASE, rather than - directly. You should not need to touch this setting. - - CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC (OMAP only) This is set by OMAP boards for the max time that reset should be asserted. See doc/README.omap-reset-time for details on how
arch/arm/cpu/arm1136/start.S +0 -27
@@ -70,32 +70,6 @@ _end_vect: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5
arch/arm/cpu/arm1176/start.S +0 -27
@@ -77,33 +77,6 @@ _end_vect: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - /* IRQ stack memory (calculated at run-time) + 8 bytes */ .globl IRQ_STACK_START_IN IRQ_STACK_START_IN:
arch/arm/cpu/arm720t/start.S +0 -26
@@ -67,32 +67,6 @@ _pad: .word 0x12345678 /* now 16*4=64 */ ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm920t/start.S +0 -26
@@ -55,32 +55,6 @@ _fiq: .word fiq ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm926ejs/at91/lowlevel_init.S +1 -13
@@ -26,27 +26,18 @@ #define CONFIG_SYS_MATRIX_EBICSA_VAL CONFIG_SYS_MATRIX_EBI0CSA_VAL #endif -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init .type lowlevel_init,function lowlevel_init: - mov r5, pc /* r5 = POS1 + 4 current */ POS1: + adr r5, POS1 /* r5 = POS1 run time */ ldr r0, =POS1 /* r0 = POS1 compile */ - ldr r2, _TEXT_BASE - sub r0, r0, r2 /* r0 = POS1-_TEXT_BASE (POS1 relative) */ sub r5, r5, r0 /* r0 = CONFIG_SYS_TEXT_BASE-1 */ - sub r5, r5, #4 /* r1 = text base - current */ /* memory control configuration 1 */ ldr r0, =SMRDATA ldr r2, =SMRDATA1 - ldr r1, _TEXT_BASE - sub r0, r0, r1 - sub r2, r2, r1 add r0, r0, r5 add r2, r2, r5 0:
@@ -149,9 +140,6 @@ PLL_setup_end: ldr r0, =SMRDATA1 ldr r2, =SMRDATA2 - ldr r1, _TEXT_BASE - sub r0, r0, r1 - sub r2, r2, r1 add r0, r0, r5 add r2, r2, r5 2:
arch/arm/cpu/arm926ejs/mxs/start.S +0 -27
@@ -101,32 +101,6 @@ fiq: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#ifdef CONFIG_SPL_TEXT_BASE - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -198,6 +172,5 @@ _reset: bx lr _hang: - ldr sp, _TEXT_BASE /* switch to abort stack */ 1: bl 1b /* hang and never return */
arch/arm/cpu/arm926ejs/start.S +0 -27
@@ -102,32 +102,6 @@ _fiq: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -330,7 +304,6 @@ flush_dcache: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* switch to abort stack */ 1: bl 1b /* hang and never return */ #else /* !CONFIG_SPL_BUILD */
arch/arm/cpu/arm946es/start.S +0 -26
@@ -71,32 +71,6 @@ _vectors_end: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm_intcm/start.S +0 -26
@@ -67,32 +67,6 @@ _fiq: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/armv7/omap3/lowlevel_init.S +0 -3
@@ -17,9 +17,6 @@ #include <asm/arch/clocks_omap3.h> #include <linux/linkage.h> -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */ - #ifdef CONFIG_SPL_BUILD ENTRY(save_boot_params) ldr r4, =omap3_boot_device
arch/arm/cpu/armv7/start.S +0 -23
@@ -63,29 +63,6 @@ _end_vect: * *************************************************************************/ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#endif - -/* - * These are defined in the board-specific linker script. - */ -.globl _bss_start_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/ixp/start.S +0 -26
@@ -80,32 +80,6 @@ _fiq: .word fiq * - jump to second stage */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/pxa/start.S +0 -27
@@ -84,32 +84,6 @@ _end_vect: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -316,7 +290,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5
arch/arm/cpu/sa1100/start.S +0 -26
@@ -56,32 +56,6 @@ _fiq: .word fiq ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/lib/board.c +6 -6
@@ -105,8 +105,8 @@ static int display_banner(void) {printf ("\n\n%s\n\n" , version_string);debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n" , - _TEXT_BASE, - _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE); + (ulong)&_start, + (ulong)&__bss_start, (ulong)&__bss_end);#ifdef CONFIG_MODEM_SUPPORT debug ("Modem Support enabled\n" );#endif
@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)memset ((void *)gd,0 ,sizeof (gd_t)); - gd->mon_len = _bss_end_ofs; + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ - gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); + gd->fdt_blob = &_end;#endif /* Allow the early environment to override the fdt address */ gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
@@ -451,7 +451,7 @@ void board_init_f(ulong bootflag) gd->relocaddr = addr; gd->start_addr_sp = addr_sp; - gd->reloc_off = addr - _TEXT_BASE; + gd->reloc_off = addr - (ulong)&_start;debug ("relocation Offset is: %08lx\n" , gd->reloc_off);if (new_fdt) {memcpy (new_fdt, gd->fdt_blob, fdt_size);
@@ -516,7 +516,7 @@ void board_init_r(gd_t *id, ulong dest_addr) gd->flags |=GD_FLG_RELOC ;/* tell others: relocation done */ bootstage_mark_name (BOOTSTAGE_ID_START_UBOOT_R ,"board_init_r" ); - monitor_flash_len = _end_ofs; + monitor_flash_len = (ulong )&__rel_dyn_end - (ulong )_start;/* Enable caches */ enable_caches ();
board/armltd/integrator/lowlevel_init.S +1 -1
@@ -183,7 +183,7 @@ cm_remap: /* Now 0x00000000 is writeable, replace the vectors */ ldr r0, =_start /* r0 <- start of vectors */ - ldr r2, =_TEXT_BASE /* r2 <- past vectors */ + add r2, r0, #64 /* r2 <- past vectors */ sub r1,r1,r1 /* destination 0x00000000 */ copy_vec:
board/cm4008/flash.c +1 -1
@@ -57,7 +57,7 @@ unsigned long flash_init (void)*/ flash_protect (FLAG_PROTECT_SET ,CONFIG_SYS_FLASH_BASE , -CONFIG_SYS_FLASH_BASE + _bss_start_ofs, +CONFIG_SYS_FLASH_BASE + (__bss_end - __bss_start), &flash_info[0 ]);return size;
board/cm41xx/flash.c +1 -1
@@ -57,7 +57,7 @@ unsigned long flash_init (void)*/ flash_protect (FLAG_PROTECT_SET ,CONFIG_SYS_FLASH_BASE , -CONFIG_SYS_FLASH_BASE + _bss_start_ofs, +CONFIG_SYS_FLASH_BASE + (__bss_end - __bss_start), &flash_info[0 ]);return size;
board/mpl/vcma9/lowlevel_init.S +1 -4
@@ -197,13 +197,10 @@ #define REFCNT_266 0 /**************************************/ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: /* use r0 to relocate DATA read/write to flash rather than memory ! */ - ldr r0, _TEXT_BASE + ldr r0, =CONFIG_SYS_TEXT_BASE ldr r13, =BWSCON /* enable minimal access to PLD */
board/mx1ads/lowlevel_init.S +0 -4
@@ -16,10 +16,6 @@ #define SDCTL0 0x221000 #define SDCTL1 0x221004 - -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: /* memory controller init */
board/samsung/goni/lowlevel_init.S +0 -3
@@ -22,9 +22,6 @@ * r9 has Mobile DDR size, 1 means 1GiB, 2 means 2GiB and so on */ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: mov r11, lr
board/samsung/smdk2410/lowlevel_init.S +1 -4
@@ -110,16 +110,13 @@ #define REFCNT 1113 /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */ /**************************************/ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ ldr r0, =SMRDATA - ldr r1, _TEXT_BASE + ldr r1, =CONFIG_SYS_TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ add r2, r0, #13*4
board/samsung/smdk5250/lowlevel_init.S +1 -4
@@ -10,9 +10,6 @@ #include <version.h> #include <asm/arch/cpu.h> -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init:
@@ -47,7 +44,7 @@ lowlevel_init: ldr r0, =0x0ffffff /* r0 <- Mask Bits*/ bic r1, pc, r0 /* pc <- current addr of code */ /* r1 <- unmasked bits of pc */ - ldr r2, _TEXT_BASE /* r2 <- original base addr in ram */ + ldr r2, =CONFIG_SYS_TEXT_BASE /* r2 <- original base addr in ram */ bic r2, r2, r0 /* r2 <- unmasked bits of r2*/ cmp r1, r2 /* compare r1, r2 */ beq 1f /* r0 == r1 then skip sdram init */
board/samsung/smdkc100/lowlevel_init.S +0 -3
@@ -17,9 +17,6 @@ * r5 has zero always */ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: mov r9, lr
board/ti/omap5912osk/lowlevel_init.S +0 -4
@@ -18,10 +18,6 @@ #include <./configs/omap1510.h> #endif - -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */ - .globl lowlevel_init lowlevel_init:
board/ti/omap730p2/lowlevel_init.S +0 -3
@@ -24,9 +24,6 @@ #include <./configs/omap730.h> #endif -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */ - .globl lowlevel_init lowlevel_init: /* Save callers address in r11 - r11 must never be modified */
common/board_f.c +7 -11
@@ -149,13 +149,9 @@ static int display_text_info(void)#ifndef CONFIG_SANDBOX ulong bss_start, bss_end; -#ifdef CONFIG_SYS_SYM_OFFSETS - bss_start = _bss_start_ofs + _TEXT_BASE; - bss_end = _bss_end_ofs + _TEXT_BASE; -#else bss_start = (ulong)&__bss_start; bss_end = (ulong)&__bss_end; -#endif +debug ("U-Boot code: %08X -> %08lX BSS: -> %08lX\n" ,CONFIG_SYS_TEXT_BASE , bss_start, bss_end);#endif
@@ -275,8 +271,8 @@ static int zero_global_data(void)static int setup_mon_len (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - gd->mon_len = _bss_end_ofs; +#ifdef __ARM__ + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#elif defined(CONFIG_SANDBOX ) gd->mon_len = (ulong )&_end - (ulong )_init;#else
@@ -358,11 +354,11 @@ static int setup_fdt(void) gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ -# ifdef CONFIG_SYS_SYM_OFFSETS - gd->fdt_blob = (void *)(_end_ofs +CONFIG_SYS_TEXT_BASE ); -# else +#ifdef CONFIG_ARM + gd->fdt_blob = (ulong *)__rel_dyn_end; +#else gd->fdt_blob = (ulong *)&_end; -# endif +#endif #elif defined(CONFIG_OF_HOSTFILE )if (read_fdt_from_file ()) {puts ("Failed to read control FDT\n" );
common/board_r.c +2 -2
@@ -128,8 +128,8 @@ __weak int fixup_cpu(void)static int initr_reloc_global_data (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - monitor_flash_len = _end_ofs; +#ifdef __ARM__ + monitor_flash_len = __rel_dyn_end - __image_copy_start;#elif !defined(CONFIG_SANDBOX ) monitor_flash_len = (ulong )&__init_end - gd->relocaddr;#endif
include/asm-generic/sections.h +7 -19
@@ -63,28 +63,16 @@ extern char __image_copy_end[];extern void _start (void );/* -* ARM needs to use offsets for symbols, since the values of some symbols -* are not resolved prior to relocation (and are just 0). Maybe this can be -* resolved, or maybe other architectures are similar, iwc this should be -* promoted to an architecture option. +* ARM defines its symbols as char[]. Other arches define them as ulongs. */ #ifdef CONFIG_ARM -#define CONFIG_SYS_SYM_OFFSETS -#endif - -#ifdef CONFIG_SYS_SYM_OFFSETS -/* Start/end of the relocation entries, as an offset from _start */ -extern ulong _rel_dyn_start_ofs; -extern ulong _rel_dyn_end_ofs; - -/* End of the region to be relocated, as an offset form _start */ -extern ulong _image_copy_end_ofs; -extern ulong _bss_start_ofs;/* BSS start relative to _start */ -extern ulong _bss_end_ofs;/* BSS end relative to _start */ -extern ulong _end_ofs;/* end of image relative to _start */ - -extern ulong _TEXT_BASE;/* code start */ +extern char __bss_start[]; +extern char __bss_end[]; +extern char __image_copy_start[]; +extern char __image_copy_end[]; +extern char __rel_dyn_start[]; +extern char __rel_dyn_end[];#else /* don't use offsets: */
Signature · 1 line
1.8.3.2
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
Quoted 14 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>---
_TEXT_BASEwas only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.In some places,
_TEXT_BASEwas locally defined only to provide a literal forCONFIG_SYS_TEXT_BASEwhen the latter could have been used directly.
Quoted 6 lines
Sometimes even,
_TEXT_BASEwas defined but unused.Since all relocations in ARM are relative, offsets,
_TEXT_BASEandCONFIG_SYS_SYM_OFFSETScan be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols fromsections.cfile.
Of course, I've done some non-regression testing before submitting, but this should undergo heavier testing by people with various ARM hardware. Considering the changes, checks should concentrate on:
- monitor_flash_len;
- gd fields mon_len, fdt_blob, and reloc_off;
- targets the lowlevel_init.S of which was moified.
Also note two things I've noticed only after posting v1:
README Configuration Settings: · line 3529
Quoted 13 lines
README +0
-5@@ -3522,12 +3522,6 @@ Configuration Settings: its config.mk file). If you find problems enabling this option on your board please report the problem and send patches! -- CONFIG_SYS_SYM_OFFSETS - This is set by architectures that use offsets for link symbols - instead of absolute values. So bss_start is obtained using an - offset _bss_start_ofs from CONFIG_SYS_TEXT_BASE, rather than - directly. You should not need to touch this setting.
The removal of CONFIG_SYS_SYM_OFFSETS from the codebase is not mentioned in the commit message. Will add in v2.
Quoted 9 lines
arch/arm/cpu/arm926ejs/at91/lowlevel_init.S +0
-1@@ -26,27 +26,18 @@ #define CONFIG_SYS_MATRIX_EBICSA_VAL CONFIG_SYS_MATRIX_EBI0CSA_VAL #endif -_TEXT_BASE:
arch/arm/cpu/arm926ejs/at91/lowlevel_init.S line 35
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/lowlevel_init.S +1
-3- .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init .type lowlevel_init,function lowlevel_init: - mov r5, pc /* r5 = POS1 + 4 current */ POS1: + adr r5, POS1 /* r5 = POS1 run time */ ldr r0, =POS1 /* r0 = POS1 compile */
This could in fact use the existing lowlevel_init label rather than introduce POS1 for this purpose. Will fix in v2.
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
In reply to Albert ARIBAUDHi Albert,
Quoted 20 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>---
_TEXT_BASEwas only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.In some places,
_TEXT_BASEwas locally defined only to provide a literal forCONFIG_SYS_TEXT_BASEwhen the latter could have been used directly.Sometimes even,
_TEXT_BASEwas defined but unused.Since all relocations in ARM are relative, offsets,
_TEXT_BASEandCONFIG_SYS_SYM_OFFSETScan be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols fromsections.cfile.
[...]
Quoted 4 lines
arch/arm/cpu/arm1136/start.S +0
-0
[...]
arch/arm/cpu/arm1136/start.S cpu_init_crit: · line 274
Quoted 8 lines
arch/arm/cpu/arm1136/start.S +0
-1@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5
Is this change (and the same change in the other start.S files) safe?
lib/hang.c/hang() may need a valid stack pointer because the functions that it calls may use the stack.
When the CPU lands in do_hang, it's because some exception occurred, which may follow a situation having corrupted sp. If sp is corrupted, the CPU won't be able to push the exception context onto the stack, but it might still be able to run the exception vector.
Setting sp to *_TEXT_BASE was not great, but at least this provided a few valid words of RAM for the stack.
[...]
Quoted 5 lines
arch/arm/lib/board.c +0
-0
arch/arm/lib/board.c static int display_banner(void) · line 112
Quoted 10 lines
arch/arm/lib/board.c +2
-2@@ -105,8 +105,8 @@ static int display_banner(void) {printf ("\n\n%s\n\n" , version_string);debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n" , - _TEXT_BASE, - _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE); + (ulong)&_start, + (ulong)&__bss_start, (ulong)&__bss_end);#ifdef CONFIG_MODEM_SUPPORT debug ("Modem Support enabled\n" );#endif
This hunk and all the other hunks using _TEXT_BASE in the same way will introduce different resulting values than the original code for targets having different build-time and run-time addresses.
This is not too much of an issue for the debug() call here, but this may be more damaging for things like gd->reloc_off below.
Quoted 34 lines
arch/arm/lib/board.c +4
-4@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)memset ((void *)gd,0 ,sizeof (gd_t)); - gd->mon_len = _bss_end_ofs; + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ - gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); + gd->fdt_blob = &_end;#endif /* Allow the early environment to override the fdt address */ gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,@@ -451,7 +451,7 @@ void board_init_f(ulong bootflag) gd->relocaddr = addr; gd->start_addr_sp = addr_sp; - gd->reloc_off = addr - _TEXT_BASE; + gd->reloc_off = addr - (ulong)&_start;debug ("relocation Offset is: %08lx\n" , gd->reloc_off);if (new_fdt) {memcpy (new_fdt, gd->fdt_blob, fdt_size);@@ -516,7 +516,7 @@ void board_init_r(gd_t *id, ulong dest_addr) gd->flags |=GD_FLG_RELOC ;/* tell others: relocation done */ bootstage_mark_name (BOOTSTAGE_ID_START_UBOOT_R ,"board_init_r" ); - monitor_flash_len = _end_ofs; + monitor_flash_len = (ulong )&__rel_dyn_end - (ulong )_start;/* Enable caches */ enable_caches ();
[...]
Quoted 9 lines
common/board_f.c +0
-1@@ -149,13 +149,9 @@ static int display_text_info(void)#ifndef CONFIG_SANDBOX ulong bss_start, bss_end; -#ifdef CONFIG_SYS_SYM_OFFSETS
common/board_f.c static int display_text_info(void) · line 157
Quoted 10 lines
common/board_f.c +1
-4- bss_start = _bss_start_ofs + _TEXT_BASE; - bss_end = _bss_end_ofs + _TEXT_BASE; -#else bss_start = (ulong)&__bss_start; bss_end = (ulong)&__bss_end; -#endif +debug ("U-Boot code: %08X -> %08lX BSS: -> %08lX\n" ,CONFIG_SYS_TEXT_BASE , bss_start, bss_end);#endif
Same comment as above regarding the use of _TEXT_BASE, except that here we want to use the runtime addresses, so the new code is more correct than the original one, and this change is hence fine.
Quoted 17 lines
common/board_f.c +2
-4@@ -275,8 +271,8 @@ static int zero_global_data(void)static int setup_mon_len (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - gd->mon_len = _bss_end_ofs; +#ifdef __ARM__ + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#elif defined(CONFIG_SANDBOX ) gd->mon_len = (ulong )&_end - (ulong )_init;#else @@ -358,11 +354,11 @@ static int setup_fdt(void) gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ -# ifdef CONFIG_SYS_SYM_OFFSETS - gd->fdt_blob = (void *)(_end_ofs +CONFIG_SYS_TEXT_BASE );
common/board_f.c static int setup_fdt(void) · line 364
Quoted 10 lines
common/board_f.c +4
-2-# else +#ifdef CONFIG_ARM + gd->fdt_blob = (ulong *)__rel_dyn_end; +#else gd->fdt_blob = (ulong *)&_end; -# endif +#endif #elif defined(CONFIG_OF_HOSTFILE )if (read_fdt_from_file ()) {puts ("Failed to read control FDT\n" );
There are 2 unrelated changes for gd->fdt_blob here for ARM:
- _end_ofs + CONFIG_SYS_TEXT_BASE -> _end,
- _end -> __rel_dyn_end.
So maybe this should be split using another patch.
Quoted 5 lines
common/board_r.c +0
-0
common/board_r.c __weak int fixup_cpu(void) · line 135
Quoted 10 lines
common/board_r.c +2
-2@@ -128,8 +128,8 @@ __weak int fixup_cpu(void)static int initr_reloc_global_data (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - monitor_flash_len = _end_ofs; +#ifdef __ARM__ + monitor_flash_len = __rel_dyn_end - __image_copy_start;#elif !defined(CONFIG_SANDBOX ) monitor_flash_len = (ulong )&__init_end - gd->relocaddr;#endif
Ditto.
[...]
Best regards,
Beno?t
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
Hi Beno?t,
Quoted 47 lines · Beno?t Th?baudeau
Hi Albert,
Quoted 20 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>---
_TEXT_BASEwas only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.In some places,
_TEXT_BASEwas locally defined only to provide a literal forCONFIG_SYS_TEXT_BASEwhen the latter could have been used directly.Sometimes even,
_TEXT_BASEwas defined but unused.Since all relocations in ARM are relative, offsets,
_TEXT_BASEandCONFIG_SYS_SYM_OFFSETScan be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols fromsections.cfile.[...]
Quoted 4 lines
arch/arm/cpu/arm1136/start.S +0
-0[...]
arch/arm/cpu/arm1136/start.S cpu_init_crit: · line 274
Quoted 8 lines
arch/arm/cpu/arm1136/start.S +0
-1@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5Is this change (and the same change in the other
start.Sfiles) safe?lib/hang.c/hang() may need a valid stack pointer because the functions that it calls may use the stack.
Quoted 7 lines
When the CPU lands in
do_hang, it's because some exception occurred, which may follow a situation having corrupted sp. If sp is corrupted, the CPU won't be able to push the exception context onto the stack, but it might still be able to run the exception vector.Setting sp to
*_TEXT_BASEwas not great, but at least this provided a few valid words of RAM for the stack.
Yes, there is a call to hang() which might or might not imply saving on the stack depending on code generation, and sp might be incorrect depending on the exception raised. I'll reintroduce the sp setting but use the runtime value of _start as stack top. As you say, not great but hey.
Quoted 22 lines
[...]
Quoted 5 lines
arch/arm/lib/board.c +0
-0arch/arm/lib/board.c static int display_banner(void) · line 112
Quoted 10 lines
arch/arm/lib/board.c +2
-2@@ -105,8 +105,8 @@ static int display_banner(void) {printf ("\n\n%s\n\n" , version_string);debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n" , - _TEXT_BASE, - _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE); + (ulong)&_start, + (ulong)&__bss_start, (ulong)&__bss_end);#ifdef CONFIG_MODEM_SUPPORT debug ("Modem Support enabled\n" );#endif This hunk and all the other hunks using
_TEXT_BASEin the same way will introduce different resulting values than the original code for targets having different build-time and run-time addresses.
Quoted 2 lines
This is not too much of an issue for the
debug()call here, but this may be more damaging for things likegd->reloc_offbelow.
Indeed build-time and run-time values might be different. Normally, U-Boot starts by being loaded at its build-time address and run from there (or directly run there if from NOR). At that point, its build- and run-time addresses coincide. then we reach relocation. Then U-Boot runs from top of RAM, with a run-time address different from its build-time one, bu with all base-address-dependent locations fixed by relocation, so again, run-time and (relocated) build-time values are equal.
IOW, this debug() line would use true build-time values if invoked before relocation, and actual run-time values after relocation, because the &symbol constructs would have relocation entries and thus be fixed during relocation.
This does not preclude corner-case situations where some in-relocation code requires knowing both the pre- and post-relocation addresses of a symbol; usually it's a matter of looking at the "in-RAM" U-Boot image vs the "in-FLASH" U-Boot image, e.g. when relocating, we copy U-Bootfrom "source" to "destination" and then fix relocation using the "source" relocation table, because there is no "destination" relocation table. Normally these corner-case situations only arise near the relocation code itself.
However, if e.g. some fields of this debug() call should be the "initial" addresses while the debug() is executed at "final" location, just point them to me.
Quoted 93 lines
Quoted 34 lines
arch/arm/lib/board.c +4
-4@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)memset ((void *)gd,0 ,sizeof (gd_t)); - gd->mon_len = _bss_end_ofs; + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ - gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); + gd->fdt_blob = &_end;#endif /* Allow the early environment to override the fdt address */ gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,@@ -451,7 +451,7 @@ void board_init_f(ulong bootflag) gd->relocaddr = addr; gd->start_addr_sp = addr_sp; - gd->reloc_off = addr - _TEXT_BASE; + gd->reloc_off = addr - (ulong)&_start;debug ("relocation Offset is: %08lx\n" , gd->reloc_off);if (new_fdt) {memcpy (new_fdt, gd->fdt_blob, fdt_size);@@ -516,7 +516,7 @@ void board_init_r(gd_t *id, ulong dest_addr) gd->flags |=GD_FLG_RELOC ;/* tell others: relocation done */ bootstage_mark_name (BOOTSTAGE_ID_START_UBOOT_R ,"board_init_r" ); - monitor_flash_len = _end_ofs; + monitor_flash_len = (ulong )&__rel_dyn_end - (ulong )_start;/* Enable caches */ enable_caches ();[...]
Quoted 9 lines
common/board_f.c +0
-1@@ -149,13 +149,9 @@ static int display_text_info(void)#ifndef CONFIG_SANDBOX ulong bss_start, bss_end; -#ifdef CONFIG_SYS_SYM_OFFSETS common/board_f.c static int display_text_info(void) · line 157
Quoted 10 lines
common/board_f.c +1
-4- bss_start = _bss_start_ofs + _TEXT_BASE; - bss_end = _bss_end_ofs + _TEXT_BASE; -#else bss_start = (ulong)&__bss_start; bss_end = (ulong)&__bss_end; -#endif +debug ("U-Boot code: %08X -> %08lX BSS: -> %08lX\n" ,CONFIG_SYS_TEXT_BASE , bss_start, bss_end);#endif Same comment as above regarding the use of
_TEXT_BASE, except that here we want to use the runtime addresses, so the new code is more correct than the original one, and this change is hence fine.Quoted 17 lines
common/board_f.c +2
-4@@ -275,8 +271,8 @@ static int zero_global_data(void)static int setup_mon_len (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - gd->mon_len = _bss_end_ofs; +#ifdef __ARM__ + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#elif defined(CONFIG_SANDBOX ) gd->mon_len = (ulong )&_end - (ulong )_init;#else @@ -358,11 +354,11 @@ static int setup_fdt(void) gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ -# ifdef CONFIG_SYS_SYM_OFFSETS - gd->fdt_blob = (void *)(_end_ofs +CONFIG_SYS_TEXT_BASE );common/board_f.c static int setup_fdt(void) · line 364
Quoted 10 lines
common/board_f.c +4
-2-# else +#ifdef CONFIG_ARM + gd->fdt_blob = (ulong *)__rel_dyn_end; +#else gd->fdt_blob = (ulong *)&_end; -# endif +#endif #elif defined(CONFIG_OF_HOSTFILE )if (read_fdt_from_file ()) {puts ("Failed to read control FDT\n" );There are 2 unrelated changes for
gd->fdt_blobhere for ARM:
-_end_ofs+CONFIG_SYS_TEXT_BASE->_end,
-_end->__rel_dyn_end.
Quoted 1 line
So maybe this should be split using another patch.
I don't think so. The switch from _end to __rel_dyn_end is done precisely to avoid using a symbol for which an offset is needed (_end, because linker-defined, can only have absolute relocations) and use instead a compiler-defined, relocatable, symbol (__rel_dyn_end, compiled from sections.c, always takes relative relocation) which does not need an offset. This switch thus belongs in this patch.
Quoted 18 lines
Quoted 5 lines
common/board_r.c +0
-0common/board_r.c __weak int fixup_cpu(void) · line 135
Quoted 10 lines
common/board_r.c +2
-2@@ -128,8 +128,8 @@ __weak int fixup_cpu(void)static int initr_reloc_global_data (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - monitor_flash_len = _end_ofs; +#ifdef __ARM__ + monitor_flash_len = __rel_dyn_end - __image_copy_start;#elif !defined(CONFIG_SANDBOX ) monitor_flash_len = (ulong )&__init_end - gd->relocaddr;#endif Ditto.
Quoted 1 line
[...]
Thanks for your review!
Quoted 2 lines
Best regards,
Beno?t
Amicalement,
Signature · 1 line
Albert.
[U-Boot] Handling hangs (was: [PATCH v1] arm: remove unneeded symbol offsets and _TEXT_BASE)
Quoted 57 lines · Albert ARIBAUD
Hi Beno?t,
Quoted 52 lines · Beno?t Th?baudeau
Hi Albert,
Quoted 20 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>---
_TEXT_BASEwas only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.In some places,
_TEXT_BASEwas locally defined only to provide a literal forCONFIG_SYS_TEXT_BASEwhen the latter could have been used directly.Sometimes even,
_TEXT_BASEwas defined but unused.Since all relocations in ARM are relative, offsets,
_TEXT_BASEandCONFIG_SYS_SYM_OFFSETScan be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols fromsections.cfile.[...]
Quoted 4 lines
arch/arm/cpu/arm1136/start.S +0
-0[...]
arch/arm/cpu/arm1136/start.S cpu_init_crit: · line 274
Quoted 8 lines
arch/arm/cpu/arm1136/start.S +0
-1@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5Is this change (and the same change in the other
start.Sfiles) safe?lib/hang.c/hang() may need a valid stack pointer because the functions that it calls may use the stack.
When the CPU lands in
do_hang, it's because some exception occurred, which may follow a situation having corrupted sp. If sp is corrupted, the CPU won't be able to push the exception context onto the stack, but it might still be able to run the exception vector.
Quoted 8 lines
Quoted 2 lines
Setting sp to
*_TEXT_BASEwas not great, but at least this provided a few valid words of RAM for the stack.Yes, there is a call to
hang()which might or might not imply saving on the stack depending on code generation, and sp might be incorrect depending on the exception raised. I'll reintroduce the sp setting but use the runtime value of_startas stack top. As you say, not great but hey.
Thinking further about hangs: when we call do_hang(), by definition we are in a critical situation where for some reason we cannot proceed any more; and in the worst scenario, the only guaranteed valid register we have is pc. Therefore, I'm not sure it is wise to try to do anything else than actually hanging.
OTOH, I do understand that we may also want to do something else than hanging, such as trying to diagnose, but we should choose more clearly:
- either we hang for the purpose of being post-mortem-debugged from there, and therefore, we limit alterations to the system state as much as we can, by only affecting pc (to the point that 'bl hang' should be turned into 'b do_hang' so that lr is also preserved);
- or we want e.g. to tell the operator about it, and we make sure we have a correct setting, that is, we reserve and use a proper stack rather than set it just below _start and hope for luck.
Choosing between one or the other would be done through a configuration option such as for instance CONFIG_SYS_LOG_HANGS.
Regarding the stack, we could use some existing exception stack, but it might be better if it was preserved, so that its contents could be looked into.
Comments?
Amicalement,
Signature · 1 line
Albert.
[U-Boot] Handling hangs (was: [PATCH v1] arm: remove unneeded symbol offsets and _TEXT_BASE)
Hi Albert,
Quoted 94 lines · Albert ARIBAUD
Quoted 66 lines · Albert ARIBAUD
Hi Beno?t,
Quoted 57 lines · Beno?t Th?baudeau
Hi Albert,
Quoted 20 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>---
_TEXT_BASEwas only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.In some places,
_TEXT_BASEwas locally defined only to provide a literal forCONFIG_SYS_TEXT_BASEwhen the latter could have been used directly.Sometimes even,
_TEXT_BASEwas defined but unused.Since all relocations in ARM are relative, offsets,
_TEXT_BASEandCONFIG_SYS_SYM_OFFSETScan be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols fromsections.cfile.[...]
Quoted 5 lines
arch/arm/cpu/arm1136/start.S +0
-0[...]
arch/arm/cpu/arm1136/start.S cpu_init_crit: · line 274
Quoted 8 lines
arch/arm/cpu/arm1136/start.S +0
-1@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5Is this change (and the same change in the other
start.Sfiles) safe?lib/hang.c/hang() may need a valid stack pointer because the functions that it
calls may use the stack.When the CPU lands in
do_hang, it's because some exception occurred, which may
follow a situation having corrupted sp. If sp is corrupted, the CPU won't be
able to push the exception context onto the stack, but it might still be able to
run the exception vector.Quoted 3 lines
Setting sp to
*_TEXT_BASEwas not great, but at least this provided a few valid
words of RAM for the stack.Quoted 5 lines
Yes, there is a call to
hang()which might or might not imply saving on the stack depending on code generation, and sp might be incorrect depending on the exception raised. I'll reintroduce the sp setting but use the runtime value of_startas stack top. As you say, not great but hey.Thinking further about hangs: when we call
do_hang(), by definition we are in a critical situation where for some reason we cannot proceed any more; and in the worst scenario, the only guaranteed valid register we have is pc. Therefore, I'm not sure it is wise to try to do anything else than actually hanging.OTOH, I do understand that we may also want to do something else than hanging, such as trying to diagnose, but we should choose more clearly:
- either we hang for the purpose of being post-mortem-debugged from there, and therefore, we limit alterations to the system state as much as we can, by only affecting pc (to the point that 'bl hang' should be turned into 'b
do_hang' so that lr is also preserved);- or we want e.g. to tell the operator about it, and we make sure we have a correct setting, that is, we reserve and use a proper stack rather than set it just below
_startand hope for luck.
Quoted 8 lines
Choosing between one or the other would be done through a configuration option such as for instance
CONFIG_SYS_LOG_HANGS.Regarding the stack, we could use some existing exception stack, but it might be better if it was preserved, so that its contents could be looked into.
Comments?
This configuration option would be great. The verbose log should be enabled by default, indicating the configuration option to change in order to investigate the hang.
In the log case, we care about having a valid stack, not about preserving the possible exception stack contents. In the post-mortem debug case, this is the opposite.
Best regards,
Beno?t
[U-Boot] Handling hangs (was: [PATCH v1] arm: remove unneeded symbol offsets and _TEXT_BASE)
Hi Beno?t,
Quoted 104 lines · Beno?t Th?baudeau
Hi Albert,
Quoted 101 lines · Albert ARIBAUD
Quoted 66 lines · Albert ARIBAUD
Hi Beno?t,
Quoted 57 lines · Beno?t Th?baudeau
Hi Albert,
Quoted 20 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>---
_TEXT_BASEwas only used by ARM to allow resolution of symbol offsets, themselves only needed due to absolute relocations.In some places,
_TEXT_BASEwas locally defined only to provide a literal forCONFIG_SYS_TEXT_BASEwhen the latter could have been used directly.Sometimes even,
_TEXT_BASEwas defined but unused.Since all relocations in ARM are relative, offsets,
_TEXT_BASEandCONFIG_SYS_SYM_OFFSETScan be completely removed, and their uses can be replaced with adequate use of compiler-generated symbols fromsections.cfile.[...]
Quoted 5 lines
arch/arm/cpu/arm1136/start.S +0
-0[...]
arch/arm/cpu/arm1136/start.S cpu_init_crit: · line 274
Quoted 8 lines
arch/arm/cpu/arm1136/start.S +0
-1@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5Is this change (and the same change in the other
start.Sfiles) safe?lib/hang.c/hang() may need a valid stack pointer because the functions that it
calls may use the stack.When the CPU lands in
do_hang, it's because some exception occurred, which may
follow a situation having corrupted sp. If sp is corrupted, the CPU won't be
able to push the exception context onto the stack, but it might still be able to
run the exception vector.Quoted 3 lines
Setting sp to
*_TEXT_BASEwas not great, but at least this provided a few valid
words of RAM for the stack.Quoted 5 lines
Yes, there is a call to
hang()which might or might not imply saving on the stack depending on code generation, and sp might be incorrect depending on the exception raised. I'll reintroduce the sp setting but use the runtime value of_startas stack top. As you say, not great but hey.Thinking further about hangs: when we call
do_hang(), by definition we are in a critical situation where for some reason we cannot proceed any more; and in the worst scenario, the only guaranteed valid register we have is pc. Therefore, I'm not sure it is wise to try to do anything else than actually hanging.OTOH, I do understand that we may also want to do something else than hanging, such as trying to diagnose, but we should choose more clearly:
- either we hang for the purpose of being post-mortem-debugged from there, and therefore, we limit alterations to the system state as much as we can, by only affecting pc (to the point that 'bl hang' should be turned into 'b
do_hang' so that lr is also preserved);- or we want e.g. to tell the operator about it, and we make sure we have a correct setting, that is, we reserve and use a proper stack rather than set it just below
_startand hope for luck.Choosing between one or the other would be done through a configuration option such as for instance
CONFIG_SYS_LOG_HANGS.Regarding the stack, we could use some existing exception stack, but it might be better if it was preserved, so that its contents could be looked into.
Quoted 5 lines
Quoted 1 line
Comments?
This configuration option would be great. The verbose log should be enabled by default, indicating the configuration option to change in order to investigate the hang.
I suspect some people would argue that for SPL, the default should be to hang rather than log.
Quoted 3 lines
In the log case, we care about having a valid stack, not about preserving the possible exception stack contents. In the post-mortem debug case, this is the opposite.
Depends. You may want the log to o as faithful a state dump as feasible.
Quoted 2 lines
Best regards,
Beno?t
Amicalement,
Signature · 1 line
Albert.
[U-Boot] Handling hangs (was: [PATCH v1] arm: remove unneeded symbol offsets and _TEXT_BASE)
Quoted 2 lines
Depends. You may want the log to o as faithful a state dump as feasible.
"...to *do* as faithful..."
Apologies,
Signature · 1 line
Albert.
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
In reply to Albert ARIBAUDHi Albert,
Quoted 35 lines · Albert ARIBAUD
Hi Beno?t,
Quoted 26 lines · Beno?t Th?baudeau
Hi Albert,
On Sunday, October 13, 2013 9:10:28 AM, Albert ARIBAUD wrote:
[...]Quoted 5 lines
arch/arm/lib/board.c +0
-0arch/arm/lib/board.c static int display_banner(void) · line 112
Quoted 10 lines
arch/arm/lib/board.c +2
-2@@ -105,8 +105,8 @@ static int display_banner(void) {printf ("\n\n%s\n\n" , version_string);debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n" , - _TEXT_BASE, - _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE); + (ulong)&_start, + (ulong)&__bss_start, (ulong)&__bss_end);#ifdef CONFIG_MODEM_SUPPORT debug ("Modem Support enabled\n" );#endif This hunk and all the other hunks using
_TEXT_BASEin the same way will introduce different resulting values than the original code for targets having
different build-time and run-time addresses.Quoted 3 lines
This is not too much of an issue for the
debug()call here, but this may be more
damaging for things likegd->reloc_offbelow.
Quoted 8 lines
Indeed build-time and run-time values might be different. Normally, U-Boot starts by being loaded at its build-time address and run from there (or directly run there if from NOR). At that point, its build- and run-time addresses coincide. then we reach relocation. Then U-Boot runs from top of RAM, with a run-time address different from its build-time one, bu with all base-address-dependent locations fixed by relocation, so again, run-time and (relocated) build-time values are equal.
That's not true for all values following relocation. E.g., in start.S, _TEXT_BASE is initialized to either CONFIG_SPL_TEXT_BASE or CONFIG_SYS_TEXT_BASE. Those are #defined, so _TEXT_BASE has the same value before and after relocation, and this value differs from &_start after relocation.
Quoted 14 lines
IOW, this
debug()line would use true build-time values if invoked before relocation, and actual run-time values after relocation, because the &symbol constructs would have relocation entries and thus be fixed during relocation.This does not preclude corner-case situations where some in-relocation code requires knowing both the pre- and post-relocation addresses of a symbol; usually it's a matter of looking at the "in-RAM" U-Boot image vs the "in-FLASH" U-Boot image, e.g. when relocating, we copy U-Bootfrom "source" to "destination" and then fix relocation using the "source" relocation table, because there is no "destination" relocation table. Normally these corner-case situations only arise near the relocation code itself.
Quoted 3 lines
However, if e.g. some fields of this
debug()call should be the "initial" addresses while thedebug()is executed at "final" location, just point them to me.
board_init_f() is called before relocation, so as long as there is no target having different build- and run-time addresses at this point (which AFAIK is the case), the changes made to this function are safe.
And display_banner() is called from board_init_f(), so everything should be fine here.
Hence, we basically just have to make sure that there is no exception board here.
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
arch/arm/lib/board.c +3
-3@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)memset ((void *)gd,0 ,sizeof (gd_t)); - gd->mon_len = _bss_end_ofs; + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ - gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); + gd->fdt_blob = &_end;#endif /* Allow the early environment to override the fdt address */ gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,@@ -451,7 +451,7 @@ void board_init_f(ulong bootflag) gd->relocaddr = addr; gd->start_addr_sp = addr_sp; - gd->reloc_off = addr - _TEXT_BASE; + gd->reloc_off = addr - (ulong)&_start;debug ("relocation Offset is: %08lx\n" , gd->reloc_off);if (new_fdt) {memcpy (new_fdt, gd->fdt_blob, fdt_size);@@ -516,7 +516,7 @@ void board_init_r(gd_t *id, ulong dest_addr) gd->flags |=GD_FLG_RELOC ;/* tell others: relocation done */ bootstage_mark_name (BOOTSTAGE_ID_START_UBOOT_R ,"board_init_r" );
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
arch/arm/lib/board.c +1
-1- monitor_flash_len = _end_ofs; + monitor_flash_len = (ulong )&__rel_dyn_end - (ulong )_start;/* Enable caches */ enable_caches ();[...]
Best regards,
Beno?t
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
Hi Beno?t,
Quoted 47 lines · Beno?t Th?baudeau
Hi Albert,
Quoted 35 lines · Albert ARIBAUD
Hi Beno?t,
Quoted 26 lines · Beno?t Th?baudeau
Hi Albert,
On Sunday, October 13, 2013 9:10:28 AM, Albert ARIBAUD wrote:
[...]Quoted 5 lines
arch/arm/lib/board.c +0
-0arch/arm/lib/board.c static int display_banner(void) · line 112
Quoted 10 lines
arch/arm/lib/board.c +2
-2@@ -105,8 +105,8 @@ static int display_banner(void) {printf ("\n\n%s\n\n" , version_string);debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n" , - _TEXT_BASE, - _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE); + (ulong)&_start, + (ulong)&__bss_start, (ulong)&__bss_end);#ifdef CONFIG_MODEM_SUPPORT debug ("Modem Support enabled\n" );#endif This hunk and all the other hunks using
_TEXT_BASEin the same way will introduce different resulting values than the original code for targets having
different build-time and run-time addresses.Quoted 3 lines
This is not too much of an issue for the
debug()call here, but this may be more
damaging for things likegd->reloc_offbelow.Quoted 8 lines
Indeed build-time and run-time values might be different. Normally, U-Boot starts by being loaded at its build-time address and run from there (or directly run there if from NOR). At that point, its build- and run-time addresses coincide. then we reach relocation. Then U-Boot runs from top of RAM, with a run-time address different from its build-time one, bu with all base-address-dependent locations fixed by relocation, so again, run-time and (relocated) build-time values are equal.
Quoted 5 lines
That's not true for all values following relocation. E.g., in
start.S,_TEXT_BASEis initialized to eitherCONFIG_SPL_TEXT_BASEorCONFIG_SYS_TEXT_BASE. Those are #defined, so_TEXT_BASEhas the same value before and after relocation, and this value differs from&_startafter relocation.
Indeed; however, I believe that in all cases where _TEXT_BASE contained CONFIG_{SYS,SPL}_TEXT_BASE, I replaced references to _TEXT_BASE with references to CONFIG_{SYS,SPL}_TEXT_BASE, which is a constant and thus will not be relocated. Unless I missed one, of course.
Similarly, in places where relocation-sensitive symbols are actually used to compute size, which is relocation-insensitive, we should not have any problems either.
Quoted 22 lines
Quoted 14 lines
IOW, this
debug()line would use true build-time values if invoked before relocation, and actual run-time values after relocation, because the &symbol constructs would have relocation entries and thus be fixed during relocation.This does not preclude corner-case situations where some in-relocation code requires knowing both the pre- and post-relocation addresses of a symbol; usually it's a matter of looking at the "in-RAM" U-Boot image vs the "in-FLASH" U-Boot image, e.g. when relocating, we copy U-Bootfrom "source" to "destination" and then fix relocation using the "source" relocation table, because there is no "destination" relocation table. Normally these corner-case situations only arise near the relocation code itself.
Quoted 3 lines
However, if e.g. some fields of this
debug()call should be the "initial" addresses while thedebug()is executed at "final" location, just point them to me.
board_init_f()is called before relocation, so as long as there is no target having different build- and run-time addresses at this point (which AFAIK is the case), the changes made to this function are safe.
Quoted 5 lines
And
display_banner()is called fromboard_init_f(), so everything should be fine here.Hence, we basically just have to make sure that there is no exception board here.
Agreed, although the only possible 'exception' would be some board code expecting relocation-sensitive symbols to keep their pre-relocation values after relocation, and I don't see why that would happen.
Thanks for your input.
Quoted 2 lines
Best regards,
Beno?t
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 arm: remove unneeded symbol offsets and _TEXT_BASE
In reply to Albert ARIBAUDQuoted 6 lines · Albert ARIBAUD
I don't think so. The switch from
_endto__rel_dyn_endis done precisely to avoid using a symbol for which an offset is needed (_end, because linker-defined, can only have absolute relocations) and use instead a compiler-defined, relocatable, symbol (__rel_dyn_end, compiled fromsections.c, always takes relative relocation) which does not need an offset. This switch thus belongs in this patch.
Actually, _end could be made a compiler-generated symbol too. This would be more consistent with what is done with the BSS and image start and end symbols, and would allow keeping _end here. Will revert change here and send v2 as a two-patch series as you suggest.
Quoted 1 line
Amicalement,
Amicalement,
Signature · 1 line
Albert.
PATCH v2 1/2 arm: make _end compiler-generated
In reply to Albert ARIBAUDThis prevents references to _end from generating absolute relocation records.
---
Changes in v2: None
arch/arm/cpu/arm1136/u-boot-spl.lds | 6 +++++- arch/arm/cpu/arm920t/ep93xx/u-boot.lds | 5 ++++- arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds | 5 ++++- arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds | 5 ++++- arch/arm/cpu/armv7/am33xx/u-boot-spl.lds | 6 +++++- arch/arm/cpu/armv7/omap-common/u-boot-spl.lds | 6 +++++- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 6 +++++- arch/arm/cpu/ixp/u-boot.lds | 5 ++++- arch/arm/cpu/u-boot-spl.lds | 5 ++++- arch/arm/cpu/u-boot.lds | 5 ++++- arch/arm/lib/Makefile | 2 +- arch/arm/lib/sections.c | 1 + board/actux1/u-boot.lds | 5 ++++- board/actux2/u-boot.lds | 5 ++++- board/actux3/u-boot.lds | 5 ++++- board/ait/cam_enc_4xx/u-boot-spl.lds | 6 +++++- board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 6 +++++- board/davinci/da8xxevm/u-boot-spl-hawk.lds | 5 ++++- board/dvlhost/u-boot.lds | 5 ++++- board/freescale/mx31ads/u-boot.lds | 5 ++++- board/samsung/common/exynos-uboot-spl.lds | 6 +++++- board/ti/am335x/u-boot.lds | 5 ++++- board/vpac270/u-boot-spl.lds | 5 ++++- 23 files changed, 93 insertions(+), 22 deletions(-)
arch/arm/cpu/arm1136/u-boot-spl.lds +5 -1
@@ -33,7 +33,11 @@ SECTIONS .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram . = ALIGN(4); __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } .bss : {
arch/arm/cpu/arm920t/ep93xx/u-boot.lds +4 -1
@@ -50,5 +50,8 @@ SECTIONS .bss : { *(.bss*) } __bss_end = .; - _end = .; + .end : + { + *(.__end) + } }
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds +4 -1
@@ -49,7 +49,10 @@ SECTIONS __bss_end = .; } - _end = .; + .end : + { + *(.__end) + } /DISCARD/ : { *(.dynstr*) } /DISCARD/ : { *(.dynsym*) }
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds +4 -1
@@ -49,7 +49,10 @@ SECTIONS __bss_end = .; } - _end = .; + .end : + { + *(.__end) + } /DISCARD/ : { *(.dynstr*) } /DISCARD/ : { *(.dynsym*) }
arch/arm/cpu/armv7/am33xx/u-boot-spl.lds +5 -1
@@ -38,7 +38,11 @@ SECTIONS . = ALIGN(4); __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } .bss : {
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds +5 -1
@@ -34,7 +34,11 @@ SECTIONS . = ALIGN(4); __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } .bss : {
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +5 -1
@@ -28,7 +28,11 @@ SECTIONS . = ALIGN(4); __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } .bss : { . = ALIGN(4);
arch/arm/cpu/ixp/u-boot.lds +4 -1
@@ -58,7 +58,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
arch/arm/cpu/u-boot-spl.lds +4 -1
@@ -42,7 +42,10 @@ SECTIONS __rel_dyn_end = .; } - _end = .; + .end : + { + *(.__end) + } .bss __rel_dyn_start (OVERLAY) : { __bss_start = .;
arch/arm/cpu/u-boot.lds +4 -1
@@ -60,7 +60,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Deprecated: this MMU section is used by pxa at present but
arch/arm/lib/Makefile +1 -1
@@ -27,7 +27,6 @@ SOBJS-y += relocate.o ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o endif -COBJS-y += sections.o COBJS-$(CONFIG_OF_LIBFDT) += bootm-fdt.o COBJS-$(CONFIG_CMD_BOOTM) += bootm.o
@@ -38,6 +37,7 @@ else COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +COBJS-y += sections.o COBJS-y += interrupts.o COBJS-y += reset.o
arch/arm/lib/sections.c +1 -0
@@ -25,3 +25,4 @@ char __image_copy_start[0] __attribute__((section(".__image_copy_start"))); char __image_copy_end[0] __attribute__((section(".__image_copy_end"))); char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start"))); char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end"))); +char _end[0] __attribute__((section(".__end")));
board/actux1/u-boot.lds +4 -1
@@ -66,7 +66,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
board/actux2/u-boot.lds +4 -1
@@ -66,7 +66,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
board/actux3/u-boot.lds +4 -1
@@ -66,7 +66,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
board/ait/cam_enc_4xx/u-boot-spl.lds +5 -1
@@ -48,5 +48,9 @@ SECTIONS } >.sram __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } }
board/davinci/da8xxevm/u-boot-spl-da850evm.lds +5 -1
@@ -49,5 +49,9 @@ SECTIONS } >.sram __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } }
board/davinci/da8xxevm/u-boot-spl-hawk.lds +4 -1
@@ -61,5 +61,8 @@ SECTIONS __bss_end = .; } - _end = .; + .end : + { + *(.__end) + } }
board/dvlhost/u-boot.lds +4 -1
@@ -66,7 +66,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
board/freescale/mx31ads/u-boot.lds +4 -1
@@ -69,7 +69,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
board/samsung/common/exynos-uboot-spl.lds +5 -1
@@ -42,7 +42,11 @@ SECTIONS . = ALIGN(4); __image_copy_end = .; - _end = .; + + .end : + { + *(.__end) + } .bss : {
board/ti/am335x/u-boot.lds +4 -1
@@ -77,7 +77,10 @@ SECTIONS *(.__rel_dyn_end) } - _end = .; + .end : + { + *(.__end) + } /* * Deprecated: this MMU section is used by pxa at present but
board/vpac270/u-boot-spl.lds +4 -1
@@ -53,7 +53,10 @@ SECTIONS . = ALIGN(0x800); - _end = .; + .end : + { + *(.__end) + } .bss __rel_dyn_start (OVERLAY) : { __bss_start = .;
Signature · 1 line
1.8.3.2
PATCH v2 2/2 arm: remove unneeded symbol offsets and _TEXT_BASE
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of _TEXT_BASE. Remove all _TEXT_BASE definitions.
---
Changes in v2:
- fixed use of _rel_dyn_end instead of _end
README | 6 ------ arch/arm/cpu/arm1136/start.S | 27 --------------------------- arch/arm/cpu/arm1176/start.S | 27 --------------------------- arch/arm/cpu/arm720t/start.S | 26 -------------------------- arch/arm/cpu/arm920t/start.S | 26 -------------------------- arch/arm/cpu/arm926ejs/at91/lowlevel_init.S | 14 +------------- arch/arm/cpu/arm926ejs/mxs/start.S | 27 --------------------------- arch/arm/cpu/arm926ejs/start.S | 27 --------------------------- arch/arm/cpu/arm946es/start.S | 26 -------------------------- arch/arm/cpu/arm_intcm/start.S | 26 -------------------------- arch/arm/cpu/armv7/omap3/lowlevel_init.S | 3 --- arch/arm/cpu/armv7/start.S | 23 ----------------------- arch/arm/cpu/ixp/start.S | 26 -------------------------- arch/arm/cpu/pxa/start.S | 27 --------------------------- arch/arm/cpu/sa1100/start.S | 26 -------------------------- arch/arm/lib/board.c | 12 ++++++------ board/armltd/integrator/lowlevel_init.S | 2 +- board/cm4008/flash.c | 2 +- board/cm41xx/flash.c | 2 +- board/mpl/vcma9/lowlevel_init.S | 5 +---- board/mx1ads/lowlevel_init.S | 4 ---- board/samsung/goni/lowlevel_init.S | 3 --- board/samsung/smdk2410/lowlevel_init.S | 5 +---- board/samsung/smdk5250/lowlevel_init.S | 5 +---- board/samsung/smdkc100/lowlevel_init.S | 3 --- board/ti/omap5912osk/lowlevel_init.S | 4 ---- board/ti/omap730p2/lowlevel_init.S | 3 --- common/board_f.c | 14 +++----------- common/board_r.c | 4 ++-- include/asm-generic/sections.h | 26 +++++++------------------- 30 files changed, 25 insertions(+), 406 deletions(-)
README +0 -6
@@ -3532,12 +3532,6 @@ Configuration Settings: its config.mk file). If you find problems enabling this option on your board please report the problem and send patches! -- CONFIG_SYS_SYM_OFFSETS - This is set by architectures that use offsets for link symbols - instead of absolute values. So bss_start is obtained using an - offset _bss_start_ofs from CONFIG_SYS_TEXT_BASE, rather than - directly. You should not need to touch this setting. - - CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC (OMAP only) This is set by OMAP boards for the max time that reset should be asserted. See doc/README.omap-reset-time for details on how
arch/arm/cpu/arm1136/start.S +0 -27
@@ -70,32 +70,6 @@ _end_vect: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -295,7 +269,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5
arch/arm/cpu/arm1176/start.S +0 -27
@@ -77,33 +77,6 @@ _end_vect: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - /* IRQ stack memory (calculated at run-time) + 8 bytes */ .globl IRQ_STACK_START_IN IRQ_STACK_START_IN:
arch/arm/cpu/arm720t/start.S +0 -26
@@ -67,32 +67,6 @@ _pad: .word 0x12345678 /* now 16*4=64 */ ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm920t/start.S +0 -26
@@ -55,32 +55,6 @@ _fiq: .word fiq ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm926ejs/at91/lowlevel_init.S +1 -13
@@ -26,27 +26,18 @@ #define CONFIG_SYS_MATRIX_EBICSA_VAL CONFIG_SYS_MATRIX_EBI0CSA_VAL #endif -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init .type lowlevel_init,function lowlevel_init: - mov r5, pc /* r5 = POS1 + 4 current */ POS1: + adr r5, POS1 /* r5 = POS1 run time */ ldr r0, =POS1 /* r0 = POS1 compile */ - ldr r2, _TEXT_BASE - sub r0, r0, r2 /* r0 = POS1-_TEXT_BASE (POS1 relative) */ sub r5, r5, r0 /* r0 = CONFIG_SYS_TEXT_BASE-1 */ - sub r5, r5, #4 /* r1 = text base - current */ /* memory control configuration 1 */ ldr r0, =SMRDATA ldr r2, =SMRDATA1 - ldr r1, _TEXT_BASE - sub r0, r0, r1 - sub r2, r2, r1 add r0, r0, r5 add r2, r2, r5 0:
@@ -149,9 +140,6 @@ PLL_setup_end: ldr r0, =SMRDATA1 ldr r2, =SMRDATA2 - ldr r1, _TEXT_BASE - sub r0, r0, r1 - sub r2, r2, r1 add r0, r0, r5 add r2, r2, r5 2:
arch/arm/cpu/arm926ejs/mxs/start.S +0 -27
@@ -101,32 +101,6 @@ fiq: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#ifdef CONFIG_SPL_TEXT_BASE - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -207,6 +181,5 @@ _reset: bx lr _hang: - ldr sp, _TEXT_BASE /* switch to abort stack */ 1: bl 1b /* hang and never return */
arch/arm/cpu/arm926ejs/start.S +0 -27
@@ -102,32 +102,6 @@ _fiq: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -330,7 +304,6 @@ flush_dcache: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* switch to abort stack */ 1: bl 1b /* hang and never return */ #else /* !CONFIG_SPL_BUILD */
arch/arm/cpu/arm946es/start.S +0 -26
@@ -71,32 +71,6 @@ _vectors_end: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm_intcm/start.S +0 -26
@@ -67,32 +67,6 @@ _fiq: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/armv7/omap3/lowlevel_init.S +0 -3
@@ -17,9 +17,6 @@ #include <asm/arch/clocks_omap3.h> #include <linux/linkage.h> -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */ - #ifdef CONFIG_SPL_BUILD ENTRY(save_boot_params) ldr r4, =omap3_boot_device
arch/arm/cpu/armv7/start.S +0 -23
@@ -63,29 +63,6 @@ _end_vect: * *************************************************************************/ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#endif - -/* - * These are defined in the board-specific linker script. - */ -.globl _bss_start_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/ixp/start.S +0 -26
@@ -80,32 +80,6 @@ _fiq: .word fiq * - jump to second stage */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/pxa/start.S +0 -27
@@ -84,32 +84,6 @@ _end_vect: ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
@@ -316,7 +290,6 @@ cpu_init_crit: #ifdef CONFIG_SPL_BUILD .align 5 do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ bl hang /* hang and never return */ #else /* !CONFIG_SPL_BUILD */ .align 5
arch/arm/cpu/sa1100/start.S +0 -26
@@ -56,32 +56,6 @@ _fiq: .word fiq ************************************************************************* */ -.globl _TEXT_BASE -_TEXT_BASE: -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE) - .word CONFIG_SPL_TEXT_BASE -#else - .word CONFIG_SYS_TEXT_BASE -#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_ofs -_bss_start_ofs: - .word __bss_start - _start - -.globl _bss_end_ofs -_bss_end_ofs: - .word __bss_end - _start - -.globl _end_ofs -_end_ofs: - .word _end - _start - #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/lib/board.c +6 -6
@@ -105,8 +105,8 @@ static int display_banner(void) {printf ("\n\n%s\n\n" , version_string);debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n" , - _TEXT_BASE, - _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE); + (ulong)&_start, + (ulong)&__bss_start, (ulong)&__bss_end);#ifdef CONFIG_MODEM_SUPPORT debug ("Modem Support enabled\n" );#endif
@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)memset ((void *)gd,0 ,sizeof (gd_t)); - gd->mon_len = _bss_end_ofs; + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ - gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); + gd->fdt_blob = &_end;#endif /* Allow the early environment to override the fdt address */ gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
@@ -451,7 +451,7 @@ void board_init_f(ulong bootflag) gd->relocaddr = addr; gd->start_addr_sp = addr_sp; - gd->reloc_off = addr - _TEXT_BASE; + gd->reloc_off = addr - (ulong)&_start;debug ("relocation Offset is: %08lx\n" , gd->reloc_off);if (new_fdt) {memcpy (new_fdt, gd->fdt_blob, fdt_size);
@@ -516,7 +516,7 @@ void board_init_r(gd_t *id, ulong dest_addr) gd->flags |=GD_FLG_RELOC ;/* tell others: relocation done */ bootstage_mark_name (BOOTSTAGE_ID_START_UBOOT_R ,"board_init_r" ); - monitor_flash_len = _end_ofs; + monitor_flash_len = (ulong )&__rel_dyn_end - (ulong )_start;/* Enable caches */ enable_caches ();
board/armltd/integrator/lowlevel_init.S +1 -1
@@ -183,7 +183,7 @@ cm_remap: /* Now 0x00000000 is writeable, replace the vectors */ ldr r0, =_start /* r0 <- start of vectors */ - ldr r2, =_TEXT_BASE /* r2 <- past vectors */ + add r2, r0, #64 /* r2 <- past vectors */ sub r1,r1,r1 /* destination 0x00000000 */ copy_vec:
board/cm4008/flash.c +1 -1
@@ -57,7 +57,7 @@ unsigned long flash_init (void)*/ flash_protect (FLAG_PROTECT_SET ,CONFIG_SYS_FLASH_BASE , -CONFIG_SYS_FLASH_BASE + _bss_start_ofs, +CONFIG_SYS_FLASH_BASE + (__bss_end - __bss_start), &flash_info[0 ]);return size;
board/cm41xx/flash.c +1 -1
@@ -57,7 +57,7 @@ unsigned long flash_init (void)*/ flash_protect (FLAG_PROTECT_SET ,CONFIG_SYS_FLASH_BASE , -CONFIG_SYS_FLASH_BASE + _bss_start_ofs, +CONFIG_SYS_FLASH_BASE + (__bss_end - __bss_start), &flash_info[0 ]);return size;
board/mpl/vcma9/lowlevel_init.S +1 -4
@@ -197,13 +197,10 @@ #define REFCNT_266 0 /**************************************/ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: /* use r0 to relocate DATA read/write to flash rather than memory ! */ - ldr r0, _TEXT_BASE + ldr r0, =CONFIG_SYS_TEXT_BASE ldr r13, =BWSCON /* enable minimal access to PLD */
board/mx1ads/lowlevel_init.S +0 -4
@@ -16,10 +16,6 @@ #define SDCTL0 0x221000 #define SDCTL1 0x221004 - -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: /* memory controller init */
board/samsung/goni/lowlevel_init.S +0 -3
@@ -22,9 +22,6 @@ * r9 has Mobile DDR size, 1 means 1GiB, 2 means 2GiB and so on */ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: mov r11, lr
board/samsung/smdk2410/lowlevel_init.S +1 -4
@@ -110,16 +110,13 @@ #define REFCNT 1113 /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */ /**************************************/ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ ldr r0, =SMRDATA - ldr r1, _TEXT_BASE + ldr r1, =CONFIG_SYS_TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ add r2, r0, #13*4
board/samsung/smdk5250/lowlevel_init.S +1 -4
@@ -10,9 +10,6 @@ #include <version.h> #include <asm/arch/cpu.h> -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init:
@@ -47,7 +44,7 @@ lowlevel_init: ldr r0, =0x0ffffff /* r0 <- Mask Bits*/ bic r1, pc, r0 /* pc <- current addr of code */ /* r1 <- unmasked bits of pc */ - ldr r2, _TEXT_BASE /* r2 <- original base addr in ram */ + ldr r2, =CONFIG_SYS_TEXT_BASE /* r2 <- original base addr in ram */ bic r2, r2, r0 /* r2 <- unmasked bits of r2*/ cmp r1, r2 /* compare r1, r2 */ beq 1f /* r0 == r1 then skip sdram init */
board/samsung/smdkc100/lowlevel_init.S +0 -3
@@ -17,9 +17,6 @@ * r5 has zero always */ -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE - .globl lowlevel_init lowlevel_init: mov r9, lr
board/ti/omap5912osk/lowlevel_init.S +0 -4
@@ -18,10 +18,6 @@ #include <./configs/omap1510.h> #endif - -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */ - .globl lowlevel_init lowlevel_init:
board/ti/omap730p2/lowlevel_init.S +0 -3
@@ -24,9 +24,6 @@ #include <./configs/omap730.h> #endif -_TEXT_BASE: - .word CONFIG_SYS_TEXT_BASE /* sdram load addr from config.mk */ - .globl lowlevel_init lowlevel_init: /* Save callers address in r11 - r11 must never be modified */
common/board_f.c +3 -11
@@ -149,13 +149,9 @@ static int display_text_info(void)#ifndef CONFIG_SANDBOX ulong bss_start, bss_end; -#ifdef CONFIG_SYS_SYM_OFFSETS - bss_start = _bss_start_ofs + _TEXT_BASE; - bss_end = _bss_end_ofs + _TEXT_BASE; -#else bss_start = (ulong)&__bss_start; bss_end = (ulong)&__bss_end; -#endif +debug ("U-Boot code: %08X -> %08lX BSS: -> %08lX\n" ,CONFIG_SYS_TEXT_BASE , bss_start, bss_end);#endif
@@ -275,8 +271,8 @@ static int zero_global_data(void)static int setup_mon_len (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - gd->mon_len = _bss_end_ofs; +#ifdef __ARM__ + gd->mon_len = (ulong )&__bss_end - (ulong )_start;#elif defined(CONFIG_SANDBOX ) gd->mon_len = (ulong )&_end - (ulong )_init;#else
@@ -358,11 +354,7 @@ static int setup_fdt(void) gd->fdt_blob = _binary_dt_dtb_start;#elif definedCONFIG_OF_SEPARATE /* FDT is at end of image */ -# ifdef CONFIG_SYS_SYM_OFFSETS - gd->fdt_blob = (void *)(_end_ofs +CONFIG_SYS_TEXT_BASE ); -# else gd->fdt_blob = (ulong *)&_end; -# endif #elif defined(CONFIG_OF_HOSTFILE )if (read_fdt_from_file ()) {puts ("Failed to read control FDT\n" );
common/board_r.c +2 -2
@@ -128,8 +128,8 @@ __weak int fixup_cpu(void)static int initr_reloc_global_data (void ) { -#ifdef CONFIG_SYS_SYM_OFFSETS - monitor_flash_len = _end_ofs; +#ifdef __ARM__ + monitor_flash_len = _end - __image_copy_start;#elif !defined(CONFIG_SANDBOX ) monitor_flash_len = (ulong )&__init_end - gd->relocaddr;#endif
include/asm-generic/sections.h +7 -19
@@ -63,28 +63,16 @@ extern char __image_copy_end[];extern void _start (void );/* -* ARM needs to use offsets for symbols, since the values of some symbols -* are not resolved prior to relocation (and are just 0). Maybe this can be -* resolved, or maybe other architectures are similar, iwc this should be -* promoted to an architecture option. +* ARM defines its symbols as char[]. Other arches define them as ulongs. */ #ifdef CONFIG_ARM -#define CONFIG_SYS_SYM_OFFSETS -#endif - -#ifdef CONFIG_SYS_SYM_OFFSETS -/* Start/end of the relocation entries, as an offset from _start */ -extern ulong _rel_dyn_start_ofs; -extern ulong _rel_dyn_end_ofs; - -/* End of the region to be relocated, as an offset form _start */ -extern ulong _image_copy_end_ofs; -extern ulong _bss_start_ofs;/* BSS start relative to _start */ -extern ulong _bss_end_ofs;/* BSS end relative to _start */ -extern ulong _end_ofs;/* end of image relative to _start */ - -extern ulong _TEXT_BASE;/* code start */ +extern char __bss_start[]; +extern char __bss_end[]; +extern char __image_copy_start[]; +extern char __image_copy_end[]; +extern char __rel_dyn_start[]; +extern char __rel_dyn_end[];#else /* don't use offsets: */
Signature · 1 line
1.8.3.2
PATCH v2 2/2 arm: remove unneeded symbol offsets and _TEXT_BASE
Hi Albert,
Quoted 5 lines · Albert ARIBAUD
Remove the last uses of symbol offsets in ARM U-Boot. Remove some needless uses of
_TEXT_BASE. Remove all_TEXT_BASEdefinitions.Signed-off-by Albert ARIBAUD <[email protected]>
Best regards,
Beno?t
PATCH v2 1/2 arm: make _end compiler-generated
In reply to Albert ARIBAUDHi Albert,
Quoted 4 lines · Albert ARIBAUD
This prevents references to
_endfrom generating absolute relocation records.Signed-off-by Albert ARIBAUD <[email protected]>
Best regards,
Beno?t