[U-Boot] [PATCH] ARM: Add .data/.rodata/.bss section starts to gd_t
Peter Barada
peter.barada at logicpd.com
Mon Feb 27 23:00:44 CET 2012
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 at 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(-)
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)
}
--
1.7.1
More information about the U-Boot
mailing list