diff mbox

[U-Boot] ARM: Add .data/.rodata/.bss section starts to gd_t

Message ID 1330380044-8305-1-git-send-email-peter.barada@logicpd.com
State Rejected
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Peter Barada Feb. 27, 2012, 10 p.m. UTC
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.

Signed-off-by: Peter Barada <peter.barada@logicpd.com>
---
 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(-)

Comments

Albert ARIBAUD Feb. 28, 2012, 10:04 p.m. UTC | #1
Hi Peter,

Le 27/02/2012 23:00, Peter Barada a écrit :
> 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.

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,
Peter Barada Feb. 29, 2012, 4:42 p.m. UTC | #2
On 02/28/2012 05:04 PM, Albert ARIBAUD wrote:
> Hi Peter,
>
> Le 27/02/2012 23:00, Peter Barada a écrit :
>> 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.
> 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>"?
Albert ARIBAUD March 1, 2012, 2:22 p.m. UTC | #3
Hi Peter,

Le 29/02/2012 17:42, Peter Barada a écrit :
> On 02/28/2012 05:04 PM, Albert ARIBAUD wrote:
>> Hi Peter,
>>
>> Le 27/02/2012 23:00, Peter Barada a écrit :
>>> 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.
>> 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>"?

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,
Peter Barada March 1, 2012, 3:57 p.m. UTC | #4
On 03/01/2012 09:22 AM, Albert ARIBAUD wrote:
> Hi Peter,
>
> Le 29/02/2012 17:42, Peter Barada a écrit :
>> On 02/28/2012 05:04 PM, Albert ARIBAUD wrote:
>>> Hi Peter,
>>>
>>> Le 27/02/2012 23:00, Peter Barada a écrit :
>>>> 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.
>>> 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>"?
> 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,
I agree with the NAK, its an issue in GDB, not u-boot...
diff mbox

Patch

diff --git a/README b/README
index eba6378..0d7a7a0 100644
--- a/README
+++ b/README
@@ -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
 
diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index c0db96c..9ab4351 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -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
diff --git a/arch/arm/cpu/arm1136/u-boot.lds b/arch/arm/cpu/arm1136/u-boot.lds
index d1e2851..751fa21 100644
--- a/arch/arm/cpu/arm1136/u-boot.lds
+++ b/arch/arm/cpu/arm1136/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index 848144a..0f8f368 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -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:
diff --git a/arch/arm/cpu/arm1176/u-boot.lds b/arch/arm/cpu/arm1176/u-boot.lds
index 27d6638..91bea89 100644
--- a/arch/arm/cpu/arm1176/u-boot.lds
+++ b/arch/arm/cpu/arm1176/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S
index 540e3c2..947deb8 100644
--- a/arch/arm/cpu/arm720t/start.S
+++ b/arch/arm/cpu/arm720t/start.S
@@ -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
diff --git a/arch/arm/cpu/arm720t/u-boot.lds b/arch/arm/cpu/arm720t/u-boot.lds
index 9370fad..308862b 100644
--- a/arch/arm/cpu/arm720t/u-boot.lds
+++ b/arch/arm/cpu/arm720t/u-boot.lds
@@ -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);
diff --git a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
index dc6ba34..29a8c9e 100644
--- a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
+++ b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
@@ -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) }
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index 8c5612c..be364f1 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -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
diff --git a/arch/arm/cpu/arm920t/u-boot.lds b/arch/arm/cpu/arm920t/u-boot.lds
index 17ba604..3999a3b 100644
--- a/arch/arm/cpu/arm920t/u-boot.lds
+++ b/arch/arm/cpu/arm920t/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm925t/start.S b/arch/arm/cpu/arm925t/start.S
index dbb93ef..9d01f19 100644
--- a/arch/arm/cpu/arm925t/start.S
+++ b/arch/arm/cpu/arm925t/start.S
@@ -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
diff --git a/arch/arm/cpu/arm925t/u-boot.lds b/arch/arm/cpu/arm925t/u-boot.lds
index 64e76f5..dac4e97 100644
--- a/arch/arm/cpu/arm925t/u-boot.lds
+++ b/arch/arm/cpu/arm925t/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm926ejs/mx28/start.S b/arch/arm/cpu/arm926ejs/mx28/start.S
index 2cd4d73..645987d 100644
--- a/arch/arm/cpu/arm926ejs/mx28/start.S
+++ b/arch/arm/cpu/arm926ejs/mx28/start.S
@@ -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
diff --git a/arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds
index 0fccd52..4ed5014 100644
--- a/arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds
+++ b/arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 6f05f1a..c87a99b 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -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
diff --git a/arch/arm/cpu/arm926ejs/u-boot.lds b/arch/arm/cpu/arm926ejs/u-boot.lds
index 1480e0c..9edaaab 100644
--- a/arch/arm/cpu/arm926ejs/u-boot.lds
+++ b/arch/arm/cpu/arm926ejs/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm946es/start.S b/arch/arm/cpu/arm946es/start.S
index 89ba558..af1f9c4 100644
--- a/arch/arm/cpu/arm946es/start.S
+++ b/arch/arm/cpu/arm946es/start.S
@@ -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
diff --git a/arch/arm/cpu/arm946es/u-boot.lds b/arch/arm/cpu/arm946es/u-boot.lds
index ff938e4..a3608ba 100644
--- a/arch/arm/cpu/arm946es/u-boot.lds
+++ b/arch/arm/cpu/arm946es/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/arm_intcm/start.S b/arch/arm/cpu/arm_intcm/start.S
index 2033b36..27b2c3c 100644
--- a/arch/arm/cpu/arm_intcm/start.S
+++ b/arch/arm/cpu/arm_intcm/start.S
@@ -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
diff --git a/arch/arm/cpu/arm_intcm/u-boot.lds b/arch/arm/cpu/arm_intcm/u-boot.lds
index f4a146c..0fbe17c 100644
--- a/arch/arm/cpu/arm_intcm/u-boot.lds
+++ b/arch/arm/cpu/arm_intcm/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds b/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
index 8867e06..fccd824 100644
--- a/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
+++ b/arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
@@ -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 = .;
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index ef08a55..c29a1d3 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -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
diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds
index 40ecf78..45011f6 100644
--- a/arch/arm/cpu/armv7/u-boot.lds
+++ b/arch/arm/cpu/armv7/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/ixp/start.S b/arch/arm/cpu/ixp/start.S
index cb32121..452f093 100644
--- a/arch/arm/cpu/ixp/start.S
+++ b/arch/arm/cpu/ixp/start.S
@@ -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
diff --git a/arch/arm/cpu/ixp/u-boot.lds b/arch/arm/cpu/ixp/u-boot.lds
index 7199de4..3f875f6 100644
--- a/arch/arm/cpu/ixp/u-boot.lds
+++ b/arch/arm/cpu/ixp/u-boot.lds
@@ -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*)
 	}
 
diff --git a/arch/arm/cpu/lh7a40x/start.S b/arch/arm/cpu/lh7a40x/start.S
index 62de8b8..a66a089 100644
--- a/arch/arm/cpu/lh7a40x/start.S
+++ b/arch/arm/cpu/lh7a40x/start.S
@@ -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
diff --git a/arch/arm/cpu/lh7a40x/u-boot.lds b/arch/arm/cpu/lh7a40x/u-boot.lds
index 30934ff..f73a6e0 100644
--- a/arch/arm/cpu/lh7a40x/u-boot.lds
+++ b/arch/arm/cpu/lh7a40x/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
index ba0de8f..f7aa19e 100644
--- a/arch/arm/cpu/pxa/start.S
+++ b/arch/arm/cpu/pxa/start.S
@@ -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
diff --git a/arch/arm/cpu/pxa/u-boot.lds b/arch/arm/cpu/pxa/u-boot.lds
index e86e781..f250876 100644
--- a/arch/arm/cpu/pxa/u-boot.lds
+++ b/arch/arm/cpu/pxa/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/s3c44b0/start.S b/arch/arm/cpu/s3c44b0/start.S
index a29d5b4..11879d7 100644
--- a/arch/arm/cpu/s3c44b0/start.S
+++ b/arch/arm/cpu/s3c44b0/start.S
@@ -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
diff --git a/arch/arm/cpu/s3c44b0/u-boot.lds b/arch/arm/cpu/s3c44b0/u-boot.lds
index 74a259c..0facaaf 100644
--- a/arch/arm/cpu/s3c44b0/u-boot.lds
+++ b/arch/arm/cpu/s3c44b0/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/cpu/sa1100/start.S b/arch/arm/cpu/sa1100/start.S
index 92546d8..4b1f2fb 100644
--- a/arch/arm/cpu/sa1100/start.S
+++ b/arch/arm/cpu/sa1100/start.S
@@ -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
diff --git a/arch/arm/cpu/sa1100/u-boot.lds b/arch/arm/cpu/sa1100/u-boot.lds
index e6381da..3cbae0d 100644
--- a/arch/arm/cpu/sa1100/u-boot.lds
+++ b/arch/arm/cpu/sa1100/u-boot.lds
@@ -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)
 	}
 
diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index c60dba2..6297be9 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -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
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index c3ff789..5f28bbf 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -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 */
diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
index 4ca75f9..99f05bd 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -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 */
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 500e216..3fdc33e 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -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));
 
diff --git a/board/ait/cam_enc_4xx/u-boot-spl.lds b/board/ait/cam_enc_4xx/u-boot-spl.lds
index 6f6e065..25b583b 100644
--- a/board/ait/cam_enc_4xx/u-boot-spl.lds
+++ b/board/ait/cam_enc_4xx/u-boot-spl.lds
@@ -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 = .;
diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
index 6f6e065..a48eaf6 100644
--- a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
+++ b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
@@ -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 = .;
diff --git a/board/davinci/da8xxevm/u-boot-spl-hawk.lds b/board/davinci/da8xxevm/u-boot-spl-hawk.lds
index b3a41af..bf29859 100644
--- a/board/davinci/da8xxevm/u-boot-spl-hawk.lds
+++ b/board/davinci/da8xxevm/u-boot-spl-hawk.lds
@@ -42,10 +42,14 @@  SECTIONS
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : {
+		__rodata_start = .;
+		*(.rodata)
+	}
 
 	. = ALIGN(4);
 	.data : {
+		__data_start = .;
 		*(.data)
 	__datarel_start = .;
 		*(.data.rel)
diff --git a/board/vpac270/u-boot-spl.lds b/board/vpac270/u-boot-spl.lds
index 1958c2f..2363fbd 100644
--- a/board/vpac270/u-boot-spl.lds
+++ b/board/vpac270/u-boot-spl.lds
@@ -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)
 	}
 
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 5359a47..8993a33 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -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);
diff --git a/nand_spl/board/freescale/mx31pdk/u-boot.lds b/nand_spl/board/freescale/mx31pdk/u-boot.lds
index d2b08f6..b743b07 100644
--- a/nand_spl/board/freescale/mx31pdk/u-boot.lds
+++ b/nand_spl/board/freescale/mx31pdk/u-boot.lds
@@ -38,10 +38,14 @@  SECTIONS
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : {
+		__rodata_start = .;
+		*(.rodata)
+	}
 
 	. = ALIGN(4);
 	.data : {
+		__data_start = .;
 		*(.data)
 	}
 
diff --git a/nand_spl/board/karo/tx25/u-boot.lds b/nand_spl/board/karo/tx25/u-boot.lds
index d2b08f6..b743b07 100644
--- a/nand_spl/board/karo/tx25/u-boot.lds
+++ b/nand_spl/board/karo/tx25/u-boot.lds
@@ -38,10 +38,14 @@  SECTIONS
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : {
+		__rodata_start = .;
+		*(.rodata)
+	}
 
 	. = ALIGN(4);
 	.data : {
+		__data_start = .;
 		*(.data)
 	}