ARM: Add .data/.rodata/.bss section starts to gd_t
PATCH 1/1 ARM: Add .data/.rodata/.bss section starts to gd_t
When debugging u-boot, after relocation its tedious to calculate positions of the various sections (.data, .rodata, .bss). To make it easier, add the structure "sections" to gd_t that contains the relocated start of those sections. Then the gdb command "add-symbol-file" can by used with "-s <section> <address>" that corresponds to the values in gd_t->sections.
--- README | 6 ++++++ arch/arm/cpu/arm1136/start.S | 10 ++++++++++ arch/arm/cpu/arm1136/u-boot.lds | 6 +++++- arch/arm/cpu/arm1176/start.S | 10 ++++++++++ arch/arm/cpu/arm1176/u-boot.lds | 6 +++++- arch/arm/cpu/arm720t/start.S | 10 ++++++++++ arch/arm/cpu/arm720t/u-boot.lds | 6 +++++- arch/arm/cpu/arm920t/ep93xx/u-boot.lds | 10 ++++++++-- arch/arm/cpu/arm920t/start.S | 10 ++++++++++ arch/arm/cpu/arm920t/u-boot.lds | 6 +++++- arch/arm/cpu/arm925t/start.S | 10 ++++++++++ arch/arm/cpu/arm925t/u-boot.lds | 6 +++++- arch/arm/cpu/arm926ejs/mx28/start.S | 10 ++++++++++ arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds | 6 +++++- arch/arm/cpu/arm926ejs/start.S | 10 ++++++++++ arch/arm/cpu/arm926ejs/u-boot.lds | 6 +++++- arch/arm/cpu/arm946es/start.S | 10 ++++++++++ arch/arm/cpu/arm946es/u-boot.lds | 6 +++++- arch/arm/cpu/arm_intcm/start.S | 10 ++++++++++ arch/arm/cpu/arm_intcm/u-boot.lds | 6 +++++- arch/arm/cpu/armv7/omap-common/u-boot-spl.lds | 11 +++++++++-- arch/arm/cpu/armv7/start.S | 10 ++++++++++ arch/arm/cpu/armv7/u-boot.lds | 6 +++++- arch/arm/cpu/ixp/start.S | 10 ++++++++++ arch/arm/cpu/ixp/u-boot.lds | 6 +++++- arch/arm/cpu/lh7a40x/start.S | 10 ++++++++++ arch/arm/cpu/lh7a40x/u-boot.lds | 6 +++++- arch/arm/cpu/pxa/start.S | 10 ++++++++++ arch/arm/cpu/pxa/u-boot.lds | 6 +++++- arch/arm/cpu/s3c44b0/start.S | 10 ++++++++++ arch/arm/cpu/s3c44b0/u-boot.lds | 6 +++++- arch/arm/cpu/sa1100/start.S | 10 ++++++++++ arch/arm/cpu/sa1100/u-boot.lds | 6 +++++- arch/arm/include/asm/config.h | 3 +++ arch/arm/include/asm/global_data.h | 13 +++++++++++++ arch/arm/include/asm/u-boot-arm.h | 4 ++++ arch/arm/lib/board.c | 7 +++++++ board/ait/cam_enc_4xx/u-boot-spl.lds | 11 +++++++++-- board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 10 ++++++++-- board/davinci/da8xxevm/u-boot-spl-hawk.lds | 6 +++++- board/vpac270/u-boot-spl.lds | 6 +++++- common/cmd_bdinfo.c | 5 +++++ nand_spl/board/freescale/mx31pdk/u-boot.lds | 6 +++++- nand_spl/board/karo/tx25/u-boot.lds | 6 +++++- 44 files changed, 317 insertions(+), 27 deletions(-)
README +6 -0
@@ -426,6 +426,12 @@ The following options need to be configured: Select high exception vectors of the ARM core, e.g., do not clear the V bit of the c1 register of CP15. + CONFIG_GDB_SECTIONS_START + + Add to gd_t "sections" structure containing starting addresses + of .bss, .data, and .rodata sections to allow + "gdb add-symbol-file" to work once u-boot is relocated. + - Linux Kernel Interface: CONFIG_CLOCKS_IN_MHZ
arch/arm/cpu/arm1136/start.S +10 -0
@@ -108,6 +108,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm1136/u-boot.lds +5 -1
@@ -45,10 +45,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm1176/start.S +10 -0
@@ -127,6 +127,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + /* IRQ stack memory (calculated at run-time) + 8 bytes */ .globl IRQ_STACK_START_IN IRQ_STACK_START_IN:
arch/arm/cpu/arm1176/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm720t/start.S +10 -0
@@ -97,6 +97,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm720t/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; } . = ALIGN(4);
arch/arm/cpu/arm920t/ep93xx/u-boot.lds +8 -2
@@ -39,10 +39,16 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(.rodata) } + .rodata : { + __rodata_start = .; + *(.rodata) + } . = ALIGN(4); - .data : { *(.data) } + .data : { + __data_start = .; + *(.data) + } . = ALIGN(4); .got : { *(.got) }
arch/arm/cpu/arm920t/start.S +10 -0
@@ -93,6 +93,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm920t/u-boot.lds +5 -1
@@ -44,10 +44,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm925t/start.S +10 -0
@@ -103,6 +103,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm925t/u-boot.lds +5 -1
@@ -39,10 +39,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm926ejs/mx28/start.S +10 -0
@@ -139,6 +139,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds +5 -1
@@ -42,10 +42,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm926ejs/start.S +10 -0
@@ -160,6 +160,16 @@ _end: .word __bss_end__ #endif +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm926ejs/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm946es/start.S +10 -0
@@ -109,6 +109,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm946es/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/arm_intcm/start.S +10 -0
@@ -105,6 +105,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/arm_intcm/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __rodata_start = .; *(.data) }
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds +9 -2
@@ -43,10 +43,17 @@ SECTIONS } >.sram . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(.rodata*)) + } >.sram . = ALIGN(4); - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + .data : { + __data_start = .; + *(SORT_BY_ALIGNMENT(.data*)) + } >.sram + . = ALIGN(4); __image_copy_end = .; _end = .;
arch/arm/cpu/armv7/start.S +10 -0
@@ -101,6 +101,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/armv7/u-boot.lds +5 -1
@@ -39,10 +39,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/ixp/start.S +10 -0
@@ -118,6 +118,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/ixp/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data*) }
arch/arm/cpu/lh7a40x/start.S +10 -0
@@ -93,6 +93,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/lh7a40x/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/pxa/start.S +10 -0
@@ -126,6 +126,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/pxa/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/s3c44b0/start.S +10 -0
@@ -84,6 +84,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/s3c44b0/u-boot.lds +5 -1
@@ -36,10 +36,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/cpu/sa1100/start.S +10 -0
@@ -94,6 +94,16 @@ _bss_end_ofs: _end_ofs: .word _end - _start +#ifdef CONFIG_GDB_SECTIONS_START +.globl _data_start_ofs +_data_start_ofs: + .word __data_start - _start + +.globl _rodata_start_ofs +_rodata_start_ofs: + .word __rodata_start - _start +#endif + #ifdef CONFIG_USE_IRQ /* IRQ stack memory (calculated at run-time) */ .globl IRQ_STACK_START
arch/arm/cpu/sa1100/u-boot.lds +5 -1
@@ -39,10 +39,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
arch/arm/include/asm/config.h +3 -0
@@ -21,6 +21,9 @@#ifndef _ASM_CONFIG_H_#define _ASM_CONFIG_H_ +/* Include section starts for .bss, .data, .rodata for "gdb add-symbol-file" */ +#define CONFIG_GDB_SECTIONS_START +#define CONFIG_LMB #define CONFIG_SYS_BOOT_RAMDISK_HIGH #endif
arch/arm/include/asm/global_data.h +13 -0
@@ -68,6 +68,19 @@ typedef struct global_data {unsigned long timestamp;#endif unsigned long relocaddr;/* Start address of U-Boot in RAM */ +#ifdef CONFIG_GDB_SECTIONS_START +/* Section start information. Used with GDB command: +* add-symbol-file u-boot $gd->relocaddr \ +* -s .data $gd->sections.data \ +* -s .rodata $gd->sections.rodata \ +* -s .bss $gd->sections.bss +*/ +struct { +unsigned long data; +unsigned long rodata; +unsigned long bss; + } sections; +#endif phys_size_t ram_size;/* RAM size */ unsigned long mon_len;/* monitor len */ unsigned long irq_sp;/* irq stack pointer */
arch/arm/include/asm/u-boot-arm.h +4 -0
@@ -33,6 +33,10 @@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 */ +#ifdef CONFIG_GDB_SECTIONS_START +extern ulong _data_start_ofs;/* .data start relative to _start */ +extern ulong _rodata_start_ofs;/* .rodata start relative to _start */ +#endif extern ulong IRQ_STACK_START ;/* top of IRQ stack */ extern ulong FIQ_STACK_START ;/* top of FIQ stack */ extern ulong _TEXT_BASE;/* code start */
arch/arm/lib/board.c +7 -0
@@ -422,6 +422,13 @@ void board_init_f(ulong bootflag) gd->relocaddr = addr; gd->start_addr_sp = addr_sp; gd->reloc_off = addr - _TEXT_BASE; +#ifdef CONFIG_GDB_SECTIONS_START +/* Save secitons starts of bss, data, rodata for +* gdb "add-symbol-file" command */ + gd->sections.bss = addr + _bss_start_ofs; + gd->sections.data = addr + _data_start_ofs; + gd->sections.rodata = addr + _rodata_start_ofs; +#endif debug ("relocation Offset is: %08lx\n" , gd->reloc_off);memcpy (id, (void *)gd,sizeof (gd_t));
board/ait/cam_enc_4xx/u-boot-spl.lds +9 -2
@@ -43,10 +43,17 @@ SECTIONS } >.sram . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(.rodata*)) + } >.sram . = ALIGN(4); - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + .data : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(.data*)) + } >.sram + . = ALIGN(4); .rel.dyn : { __rel_dyn_start = .;
board/davinci/da8xxevm/u-boot-spl-da850evm.lds +8 -2
@@ -43,10 +43,16 @@ SECTIONS } >.sram . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(.rodata*)) + } >.sram . = ALIGN(4); - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + .data : { + __data_start = .; + *(SORT_BY_ALIGNMENT(.data*)) + } >.sram . = ALIGN(4); .rel.dyn : { __rel_dyn_start = .;
board/davinci/da8xxevm/u-boot-spl-hawk.lds +5 -1
@@ -42,10 +42,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(.rodata) } + .rodata : { + __rodata_start = .; + *(.rodata) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) __datarel_start = .; *(.data.rel)
board/vpac270/u-boot-spl.lds +5 -1
@@ -50,10 +50,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + .rodata : { + __rodata_start = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
common/cmd_bdinfo.c +5 -0
@@ -367,6 +367,11 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#endif print_num ("relocaddr" , gd->relocaddr);print_num ("reloc off" , gd->reloc_off); +#ifdef CONFIG_GDB_SECTIONS_START +print_num ("data_start" , gd->sections.data); +print_num ("rodata_start" , gd->sections.rodata); +print_num ("bss_start" , gd->sections.bss); +#endif print_num ("irq_sp" , gd->irq_sp);/* irq stack pointer */ print_num ("sp start " , gd->start_addr_sp);print_num ("FB base " , gd->fb_base);
nand_spl/board/freescale/mx31pdk/u-boot.lds +5 -1
@@ -38,10 +38,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(.rodata) } + .rodata : { + __rodata_start = .; + *(.rodata) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
nand_spl/board/karo/tx25/u-boot.lds +5 -1
@@ -38,10 +38,14 @@ SECTIONS } . = ALIGN(4); - .rodata : { *(.rodata) } + .rodata : { + __rodata_start = .; + *(.rodata) + } . = ALIGN(4); .data : { + __data_start = .; *(.data) }
Signature · 1 line
1.7.1
PATCH 1/1 ARM: Add .data/.rodata/.bss section starts to gd_t
Hi Peter,
Le 27/02/2012 23:00, Peter Barada a ?crit :
Quoted 5 lines
When debugging u-boot, after relocation its tedious to calculate positions of the various sections (.data, .rodata, .bss). To make it easier, add the structure "sections" to
gd_tthat contains the relocated start of those sections. Then the gdb command "add-symbol-file" can by used with "-s<section> <address>" that corresponds to the values ingd_t->sections.
NAK until I get an explanation and usage scenario for this, because I've never had to do calculations on sections so far, so I want to understand why it would be needed.
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 ARM: Add .data/.rodata/.bss section starts to gd_t
Quoted 8 lines · Albert ARIBAUD
Hi Peter,
Le 27/02/2012 23:00, Peter Barada a ?crit :
Quoted 5 lines
When debugging u-boot, after relocation its tedious to calculate positions of the various sections (.data, .rodata, .bss). To make it easier, add the structure "sections" to
gd_tthat contains the relocated start of those sections. Then the gdb command "add-symbol-file" can by used with "-s<section> <address>" that corresponds to the values ingd_t->sections.
Quoted 5 lines
NAK until I get an explanation and usage scenario for this, because I've never had to do calculations on sections so far, so I want to understand why it would be needed.
Amicalement,
Weird. Digging further its looking more like a problem with GDB...
I'm using the CodeSourcery 2009q1-203 toolchain (for ARM), and "add-symbol-file u-boot 0x...." only relocated symbols in the .text segment, not .data, .rodata, and .bss sections. Looking at newer toolchains (CodeSourcery 2011.09-70) I see even stranger results:
Current directory is /home/peter/work/logic/git/u-boot-branches/ GNU gdb (Sourcery CodeBench Lite 2011.09-70) 7.2.50.20100908-cvs Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi".
For bug reporting instructions, please see:
<https://support.codesourcery.com/GNUToolchain/>...
Reading symbols from /home/peter/work/logic/git/u-boot-branches/u-boot...done. (gdb) info file
Symbols from "/home/peter/work/logic/git/u-boot-branches/u-boot". Local exec file:
`/home/peter/work/logic/git/u-boot-branches/u-boot', file type
elf32-littlearm.
Entry point: 0x80100000
0x80100000 - 0x80124a30 is .text
0x80124a30 - 0x8012d43a is .rodata
0x8012d43c - 0x8012d488 is .hash
0x8012d488 - 0x8012dee0 is .data
0x8012dee0 - 0x8012deec is .got.plt
0x8012deec - 0x8012e544 is .u_boot_cmd
0x8013354c - 0x8013362c is .dynsym
0x8012e544 - 0x8013354c is .rel.dyn
0x8012e544 - 0x80165388 is .bss(gdb)(gdb) symbol-file
Discard symbol table from `/home/peter/work/logic/git/u-boot-branches/u-boot'? (y or n) y No symbol file now.
(gdb) *add-symbol-file u-boot 0x8ff8a000 -readnow -s .rodata 0x8FFAEA30 -s .data 0x8FFB7488 -s .bss 0x8FFB8544*
add symbol table from file "u-boot" at
.text_addr = 0x8ff8a000
.rodata_addr = 0x8ffaea30
.data_addr = 0x8ffb7488
.bss_addr = 0x8ffb8544(y or n) y
Reading symbols from /home/peter/work/logic/git/u-boot-branches/u-boot...expanding to full symbols...done.
(gdb) *p &stdio_devices*
$26 = (struct stdio_dev *(*)[3]) *0x80131c0c*
(gdb) info sym stdio_devices__rel_dyn_start + 14024 in section .rel.dyn
(gdb) info sym boards
boards in section .data
(gdb) p *&boards*
$27 = (struct board_id (*)[2][2]) *0x8ffb7ec0*
(gdb) shell nm u-boot | grep stdio_devices
*80131c0c* B stdio_devices
(gdb) shell nm u-boot | grep boards
*8012dec0* d boards
(gdb)
Note that "boards" gets properly relocated whereas "stdio_devices" does not - apparently a lot (all?) of the .bss symbols are not properly relocated. Hmm, I wonder if this is caused by .rel.dyn overlaing .bss...
Which version of GDB are you using on ARM that properly relocates all the sections after "add-symbol-file u-boot <addr>"?
Signature · 2 lines
Peter Barada peter.barada at logicpd.com
PATCH 1/1 ARM: Add .data/.rodata/.bss section starts to gd_t
Hi Peter,
Le 29/02/2012 17:42, Peter Barada a ?crit :
Quoted 79 lines · Albert ARIBAUD
Quoted 8 lines
Hi Peter,
Le 27/02/2012 23:00, Peter Barada a ?crit :
Quoted 5 lines
When debugging u-boot, after relocation its tedious to calculate positions of the various sections (.data, .rodata, .bss). To make it easier, add the structure "sections" to
gd_tthat contains the relocated start of those sections. Then the gdb command "add-symbol-file" can by used with
"-s<section> <address>" that corresponds to the values ingd_t->sections.Quoted 5 lines
NAK until I get an explanation and usage scenario for this, because I've never had to do calculations on sections so far, so I want to understand why it would be needed.
Amicalement,
Weird. Digging further its looking more like a problem with GDB...
I'm using the CodeSourcery 2009q1-203 toolchain (for ARM), and "add-symbol-file u-boot 0x...." only relocated symbols in the .text segment, not .data, .rodata, and .bss sections. Looking at newer toolchains (CodeSourcery 2011.09-70) I see even stranger results:
Current directory is
/home/peter/work/logic/git/u-boot-branches/GNU gdb (Sourcery CodeBench Lite 2011.09-70) 7.2.50.20100908-cvs Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi".
For bug reporting instructions, please see:
<https://support.codesourcery.com/GNUToolchain/>...
Reading symbols from/home/peter/work/logic/git/u-boot-branches/u-boot...done. (gdb) info file
Symbols from "/home/peter/work/logic/git/u-boot-branches/u-boot". Local exec file:
`/home/peter/work/logic/git/u-boot-branches/u-boot', file type
elf32-littlearm.Entry point: 0x80100000 0x80100000 - 0x80124a30 is .text 0x80124a30 - 0x8012d43a is .rodata 0x8012d43c - 0x8012d488 is .hash 0x8012d488 - 0x8012dee0 is .data 0x8012dee0 - 0x8012deec is .got.plt 0x8012deec - 0x8012e544 is .u_boot_cmd 0x8013354c - 0x8013362c is .dynsym 0x8012e544 - 0x8013354c is .rel.dyn 0x8012e544 - 0x80165388 is .bss(gdb)(gdb) symbol-file
Discard symbol table from `/home/peter/work/logic/git/u-boot-branches/u-boot'? (y or n) y No symbol file now.
(gdb) *add-symbol-file u-boot0x8ff8a000-readnow -s .rodata0x8FFAEA30-s .data0x8FFB7488-s .bss 0x8FFB8544*
add symbol table from file "u-boot" at.text_addr = 0x8ff8a000 .rodata_addr = 0x8ffaea30 .data_addr = 0x8ffb7488 .bss_addr = 0x8ffb8544(y or n) y
Reading symbols from/home/peter/work/logic/git/u-boot-branches/u-boot...expandingto full symbols...done.
(gdb) *p&stdio_devices*
$26 = (structstdio_dev*(*)[3]) *0x80131c0c*
(gdb) info symstdio_devices__rel_dyn_start+ 14024 in section .rel.dyn
(gdb) info sym boards
boards in section .data
(gdb) p *&boards*
$27 = (structboard_id(*)[2][2]) *0x8ffb7ec0*
(gdb) shell nm u-boot | grepstdio_devices
*80131c0c* Bstdio_devices
(gdb) shell nm u-boot | grep boards
*8012dec0* d boards
(gdb)
Quoted 6 lines
Note that "boards" gets properly relocated whereas "
stdio_devices" does not - apparently a lot (all?) of the .bss symbols are not properly relocated. Hmm, I wonder if this is caused by .rel.dyn overlaing .bss...Which version of GDB are you using on ARM that properly relocates all the sections after "add-symbol-file u-boot<addr>"?
I routinely use ELDK42 (4.2.2 toochain) and stcok (linaro) Ubuntu (4.6.1). I don't remember having hit this issue -- although I am hitting another one where breakpoints are set 4 or 8 bytes further than they should, but the symbols themselves are ok; but I rarely use global .data or .bss symbols, so I may have missed the issue.
Anyway, 'help add-symbol-file' says a single address applies to consecutive sections, so until it is sorted out with the GDB people why this does not work, my NAK still holds.
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 ARM: Add .data/.rodata/.bss section starts to gd_t
Quoted 94 lines · Albert ARIBAUD
Hi Peter,
Le 29/02/2012 17:42, Peter Barada a ?crit :
Quoted 79 lines · Albert ARIBAUD
Quoted 8 lines
Hi Peter,
Le 27/02/2012 23:00, Peter Barada a ?crit :
Quoted 5 lines
When debugging u-boot, after relocation its tedious to calculate positions of the various sections (.data, .rodata, .bss). To make it easier, add the structure "sections" to
gd_tthat contains the relocated start of those sections. Then the gdb command "add-symbol-file" can by used with
"-s<section> <address>" that corresponds to the values ingd_t->sections.Quoted 5 lines
NAK until I get an explanation and usage scenario for this, because I've never had to do calculations on sections so far, so I want to understand why it would be needed.
Amicalement,
Weird. Digging further its looking more like a problem with GDB...
I'm using the CodeSourcery 2009q1-203 toolchain (for ARM), and "add-symbol-file u-boot 0x...." only relocated symbols in the .text segment, not .data, .rodata, and .bss sections. Looking at newer toolchains (CodeSourcery 2011.09-70) I see even stranger results:
Current directory is
/home/peter/work/logic/git/u-boot-branches/GNU gdb (Sourcery CodeBench Lite 2011.09-70) 7.2.50.20100908-cvs Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi".
For bug reporting instructions, please see:
<https://support.codesourcery.com/GNUToolchain/>...
Reading symbols from/home/peter/work/logic/git/u-boot-branches/u-boot...done. (gdb) info file
Symbols from "/home/peter/work/logic/git/u-boot-branches/u-boot". Local exec file:
`/home/peter/work/logic/git/u-boot-branches/u-boot', file type
elf32-littlearm.Entry point: 0x80100000 0x80100000 - 0x80124a30 is .text 0x80124a30 - 0x8012d43a is .rodata 0x8012d43c - 0x8012d488 is .hash 0x8012d488 - 0x8012dee0 is .data 0x8012dee0 - 0x8012deec is .got.plt 0x8012deec - 0x8012e544 is .u_boot_cmd 0x8013354c - 0x8013362c is .dynsym 0x8012e544 - 0x8013354c is .rel.dyn 0x8012e544 - 0x80165388 is .bss(gdb)(gdb) symbol-file
Discard symbol table from `/home/peter/work/logic/git/u-boot-branches/u-boot'? (y or n) y No symbol file now.
(gdb) *add-symbol-file u-boot0x8ff8a000-readnow -s .rodata0x8FFAEA30-s .data0x8FFB7488-s .bss 0x8FFB8544*
add symbol table from file "u-boot" at.text_addr = 0x8ff8a000 .rodata_addr = 0x8ffaea30 .data_addr = 0x8ffb7488 .bss_addr = 0x8ffb8544(y or n) y
Reading symbols from/home/peter/work/logic/git/u-boot-branches/u-boot...expandingto full symbols...done.
(gdb) *p&stdio_devices*
$26 = (structstdio_dev*(*)[3]) *0x80131c0c*
(gdb) info symstdio_devices__rel_dyn_start+ 14024 in section .rel.dyn
(gdb) info sym boards
boards in section .data
(gdb) p *&boards*
$27 = (structboard_id(*)[2][2]) *0x8ffb7ec0*
(gdb) shell nm u-boot | grepstdio_devices
*80131c0c* Bstdio_devices
(gdb) shell nm u-boot | grep boards
*8012dec0* d boards
(gdb)Quoted 6 lines
Note that "boards" gets properly relocated whereas "
stdio_devices" does not - apparently a lot (all?) of the .bss symbols are not properly relocated. Hmm, I wonder if this is caused by .rel.dyn overlaing .bss...Which version of GDB are you using on ARM that properly relocates all the sections after "add-symbol-file u-boot<addr>"?
I routinely use ELDK42 (4.2.2 toochain) and stcok (linaro) Ubuntu (4.6.1). I don't remember having hit this issue -- although I am hitting another one where breakpoints are set 4 or 8 bytes further than they should, but the symbols themselves are ok; but I rarely use global .data or .bss symbols, so I may have missed the issue.
Quoted 5 lines
Anyway, 'help add-symbol-file' says a single address applies to consecutive sections, so until it is sorted out with the GDB people why this does not work, my NAK still holds.
Amicalement,
I agree with the NAK, its an issue in GDB, not u-boot...
Signature · 2 lines
Peter Barada peter.barada at logicpd.com