mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* cleanup linker variables
@ 2011-01-17 10:16 Sascha Hauer
  2011-01-17 10:16 ` [PATCH 1/9] ppc pcm030: provide _stext, _text and __bss_stop in linker script Sascha Hauer
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

The following series aims to cleanup the linker provided variables.
Jean, I still use _end instead of _barebox_end, just because it
is used by the Linux Kernel aswell.

Sascha

The following changes since commit 2f0109b1bb833fe3481b37a6cfa0ae319d248754:

  Merge branch 'master' into next (2011-01-17 09:43:40 +0100)

are available in the git repository at:

  bla ..BRANCH.NOT.VERIFIED..

Sascha Hauer (9):
      ppc pcm030: provide _stext, _text and __bss_stop in linker script
      blackfin: provide __bss_stop in linker script
      ARM: provide __bss_stop in linker script
      add sections.h header file
      ARM start.c: use sections.h header file for linker variables
      ARM: remove unnecessary include
      x86: use sections.h header file for linker variables
      reloc.h: remove linker variables which are now in asm/sections.h
      startup: make debug printing of linker variables work again

 arch/arm/cpu/start.c                      |    5 ++---
 arch/arm/include/asm/sections.h           |    1 +
 arch/arm/lib/arm.c                        |    1 -
 arch/arm/lib/barebox.lds.S                |    1 +
 arch/blackfin/boards/ipe337/barebox.lds.S |    1 +
 arch/blackfin/include/asm/sections.h      |    1 +
 arch/ppc/boards/pcm030/barebox.lds.S      |    3 +++
 arch/ppc/include/asm/sections.h           |    1 +
 arch/sandbox/include/asm/sections.h       |    1 +
 arch/x86/boot/main_entry.c                |    7 ++-----
 arch/x86/include/asm/sections.h           |    1 +
 arch/x86/lib/barebox.lds.S                |    2 +-
 common/startup.c                          |    5 +++--
 include/asm-generic/sections.h            |    8 ++++++++
 include/reloc.h                           |    2 +-
 15 files changed, 27 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/include/asm/sections.h
 create mode 100644 arch/blackfin/include/asm/sections.h
 create mode 100644 arch/ppc/include/asm/sections.h
 create mode 100644 arch/sandbox/include/asm/sections.h
 create mode 100644 arch/x86/include/asm/sections.h
 create mode 100644 include/asm-generic/sections.h


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/9] ppc pcm030: provide _stext, _text and __bss_stop in linker script
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:16 ` [PATCH 2/9] blackfin: provide " Sascha Hauer
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/ppc/boards/pcm030/barebox.lds.S |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S
index ab99335..21bf4a7 100644
--- a/arch/ppc/boards/pcm030/barebox.lds.S
+++ b/arch/ppc/boards/pcm030/barebox.lds.S
@@ -55,6 +55,8 @@ SECTIONS
   .plt : { *(.plt) }
   .text      :
   {
+    _text = .;
+    _stext = .;
     arch/ppc/mach-mpc5xxx/start.o	(.text)
     *(.text*)
     *(.got1*)
@@ -134,6 +136,7 @@ SECTIONS
    *(.bss*)
    *(COMMON)
   }
+  __bss_stop = .;
   _end = . ;
   PROVIDE (end = .);
 }
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/9] blackfin: provide __bss_stop in linker script
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
  2011-01-17 10:16 ` [PATCH 1/9] ppc pcm030: provide _stext, _text and __bss_stop in linker script Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:16 ` [PATCH 3/9] ARM: " Sascha Hauer
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/blackfin/boards/ipe337/barebox.lds.S |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/blackfin/boards/ipe337/barebox.lds.S b/arch/blackfin/boards/ipe337/barebox.lds.S
index 4299b82..571eeb1 100644
--- a/arch/blackfin/boards/ipe337/barebox.lds.S
+++ b/arch/blackfin/boards/ipe337/barebox.lds.S
@@ -82,6 +82,7 @@ SECTIONS
 	. = ALIGN(4);
 	__bss_start = .;
 	.bss : { *(.bss) }
+	__bss_stop = .;
 	_end = .;
 }
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/9] ARM: provide __bss_stop in linker script
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
  2011-01-17 10:16 ` [PATCH 1/9] ppc pcm030: provide _stext, _text and __bss_stop in linker script Sascha Hauer
  2011-01-17 10:16 ` [PATCH 2/9] blackfin: provide " Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:16 ` [PATCH 4/9] add sections.h header file Sascha Hauer
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/lib/barebox.lds.S |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S
index 5bee0a1..cc74b2f 100644
--- a/arch/arm/lib/barebox.lds.S
+++ b/arch/arm/lib/barebox.lds.S
@@ -75,5 +75,6 @@ SECTIONS
 	. = ALIGN(4);
 	__bss_start = .;
 	.bss : { *(.bss*) }
+	__bss_stop = .;
 	_end = .;
 }
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/9] add sections.h header file
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
                   ` (2 preceding siblings ...)
  2011-01-17 10:16 ` [PATCH 3/9] ARM: " Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:16 ` [PATCH 5/9] ARM start.c: use sections.h header file for linker variables Sascha Hauer
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

The file location and variable names from the Linux Kernel have been
used here.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/include/asm/sections.h      |    1 +
 arch/blackfin/include/asm/sections.h |    1 +
 arch/ppc/include/asm/sections.h      |    1 +
 arch/sandbox/include/asm/sections.h  |    1 +
 arch/x86/include/asm/sections.h      |    1 +
 include/asm-generic/sections.h       |    8 ++++++++
 6 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/sections.h
 create mode 100644 arch/blackfin/include/asm/sections.h
 create mode 100644 arch/ppc/include/asm/sections.h
 create mode 100644 arch/sandbox/include/asm/sections.h
 create mode 100644 arch/x86/include/asm/sections.h
 create mode 100644 include/asm-generic/sections.h

diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h
new file mode 100644
index 0000000..2b8c516
--- /dev/null
+++ b/arch/arm/include/asm/sections.h
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h
new file mode 100644
index 0000000..2b8c516
--- /dev/null
+++ b/arch/blackfin/include/asm/sections.h
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
diff --git a/arch/ppc/include/asm/sections.h b/arch/ppc/include/asm/sections.h
new file mode 100644
index 0000000..2b8c516
--- /dev/null
+++ b/arch/ppc/include/asm/sections.h
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
diff --git a/arch/sandbox/include/asm/sections.h b/arch/sandbox/include/asm/sections.h
new file mode 100644
index 0000000..2b8c516
--- /dev/null
+++ b/arch/sandbox/include/asm/sections.h
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h
new file mode 100644
index 0000000..2b8c516
--- /dev/null
+++ b/arch/x86/include/asm/sections.h
@@ -0,0 +1 @@
+#include <asm-generic/sections.h>
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
new file mode 100644
index 0000000..c5d60a9
--- /dev/null
+++ b/include/asm-generic/sections.h
@@ -0,0 +1,8 @@
+#ifndef _ASM_GENERIC_SECTIONS_H_
+#define _ASM_GENERIC_SECTIONS_H_
+
+extern char _text[], _stext[], _etext[];
+extern char __bss_start[], __bss_stop[];
+extern char _end[];
+
+#endif /* _ASM_GENERIC_SECTIONS_H_ */
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/9] ARM start.c: use sections.h header file for linker variables
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
                   ` (3 preceding siblings ...)
  2011-01-17 10:16 ` [PATCH 4/9] add sections.h header file Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:16 ` [PATCH 6/9] ARM: remove unnecessary include Sascha Hauer
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index b55df5d..e0fb712 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -25,6 +25,7 @@
 #include <asm/barebox-arm.h>
 #include <asm/system.h>
 #include <asm-generic/memory_layout.h>
+#include <asm/sections.h>
 
 void __naked __section(.text_entry) exception_vectors(void)
 {
@@ -40,8 +41,6 @@ void __naked __section(.text_entry) exception_vectors(void)
 	);
 }
 
-extern char __bss_start, _end;
-
 /*
  * The actual reset vector. This code is position independent and usually
  * does not run at the address it's linked at.
@@ -108,7 +107,7 @@ void __naked __bare_init board_init_lowlevel_return(void)
 				(unsigned int)&__bss_start - TEXT_BASE);
 
 	/* clear bss */
-	memset(&__bss_start, 0, &_end - &__bss_start);
+	memset(__bss_start, 0, __bss_stop - __bss_start);
 
 	/* call start_barebox with its absolute address */
 	r = (unsigned int)&start_barebox;
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 6/9] ARM: remove unnecessary include
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
                   ` (4 preceding siblings ...)
  2011-01-17 10:16 ` [PATCH 5/9] ARM start.c: use sections.h header file for linker variables Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:16 ` [PATCH 7/9] x86: use sections.h header file for linker variables Sascha Hauer
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/lib/arm.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/lib/arm.c b/arch/arm/lib/arm.c
index 8ac9ff4..6549118 100644
--- a/arch/arm/lib/arm.c
+++ b/arch/arm/lib/arm.c
@@ -3,7 +3,6 @@
 #include <mem_malloc.h>
 #include <asm/barebox-arm.h>
 #include <asm-generic/memory_layout.h>
-#include <reloc.h>
 
 static int arm_mem_malloc_init(void)
 {
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 7/9] x86: use sections.h header file for linker variables
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
                   ` (5 preceding siblings ...)
  2011-01-17 10:16 ` [PATCH 6/9] ARM: remove unnecessary include Sascha Hauer
@ 2011-01-17 10:16 ` Sascha Hauer
  2011-01-17 10:17 ` [PATCH 8/9] reloc.h: remove linker variables which are now in asm/sections.h Sascha Hauer
  2011-01-17 10:17 ` [PATCH 9/9] startup: make debug printing of linker variables work again Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:16 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/x86/boot/main_entry.c |    7 ++-----
 arch/x86/lib/barebox.lds.S |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/boot/main_entry.c b/arch/x86/boot/main_entry.c
index 5f199e9..d1d8f34 100644
--- a/arch/x86/boot/main_entry.c
+++ b/arch/x86/boot/main_entry.c
@@ -24,10 +24,7 @@
  */
 
 #include <string.h>
-
-/* These symbols are generated by the linker */
-extern char __bss_start;
-extern char __bss_end;
+#include <asm/sections.h>
 
 extern void start_barebox(void);
 
@@ -39,6 +36,6 @@ extern void start_barebox(void);
 void uboot_entry(void)
 {
 	/* clear the BSS first */
-	memset(&__bss_start, 0x00, &__bss_end - &__bss_start);
+	memset(__bss_start, 0x00, __bss_stop - __bss_start);
 	start_barebox();
 }
diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S
index 2917d2f..e0919a6 100644
--- a/arch/x86/lib/barebox.lds.S
+++ b/arch/x86/lib/barebox.lds.S
@@ -188,7 +188,7 @@ SECTIONS
 		__bss_start = .;
 		*(.bss*);
 		*( COMMON )
-		__bss_end = .;
+		__bss_stop = .;
 		_end = .;
 	} > barebox
 }
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 8/9] reloc.h: remove linker variables which are now in asm/sections.h
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
                   ` (6 preceding siblings ...)
  2011-01-17 10:16 ` [PATCH 7/9] x86: use sections.h header file for linker variables Sascha Hauer
@ 2011-01-17 10:17 ` Sascha Hauer
  2011-01-17 10:17 ` [PATCH 9/9] startup: make debug printing of linker variables work again Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:17 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/reloc.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/reloc.h b/include/reloc.h
index 22cb886..cc99866 100644
--- a/include/reloc.h
+++ b/include/reloc.h
@@ -1,7 +1,7 @@
 #ifndef __RELOC_H
 #define __RELOC_H
 
-extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base;
+extern unsigned long _text_base;
 
 #ifdef CONFIG_HAS_EARLY_INIT
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 9/9] startup: make debug printing of linker variables work again
  2011-01-17 10:16 cleanup linker variables Sascha Hauer
                   ` (7 preceding siblings ...)
  2011-01-17 10:17 ` [PATCH 8/9] reloc.h: remove linker variables which are now in asm/sections.h Sascha Hauer
@ 2011-01-17 10:17 ` Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:17 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/startup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 0d7ccb9..aa76cb7 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -40,6 +40,7 @@
 #include <environment.h>
 #include <reloc.h>
 #include <asm-generic/memory_layout.h>
+#include <asm/sections.h>
 
 extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[],
 		  __barebox_initcalls_end[];
@@ -50,8 +51,8 @@ static void display_meminfo(void)
 	ulong mend   = mem_malloc_end();
 	ulong msize  = mend - mstart + 1;
 
-	debug("barebox code : 0x%08lX -> 0x%08lX  BSS: -> 0x%08lX\n",
-	       _barebox_start, _bss_start, _bss_end);
+	debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext);
+	debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop);
 	printf("Malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
 		mstart, mend, size_human_readable(msize));
 #ifdef CONFIG_ARM
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-17 10:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-17 10:16 cleanup linker variables Sascha Hauer
2011-01-17 10:16 ` [PATCH 1/9] ppc pcm030: provide _stext, _text and __bss_stop in linker script Sascha Hauer
2011-01-17 10:16 ` [PATCH 2/9] blackfin: provide " Sascha Hauer
2011-01-17 10:16 ` [PATCH 3/9] ARM: " Sascha Hauer
2011-01-17 10:16 ` [PATCH 4/9] add sections.h header file Sascha Hauer
2011-01-17 10:16 ` [PATCH 5/9] ARM start.c: use sections.h header file for linker variables Sascha Hauer
2011-01-17 10:16 ` [PATCH 6/9] ARM: remove unnecessary include Sascha Hauer
2011-01-17 10:16 ` [PATCH 7/9] x86: use sections.h header file for linker variables Sascha Hauer
2011-01-17 10:17 ` [PATCH 8/9] reloc.h: remove linker variables which are now in asm/sections.h Sascha Hauer
2011-01-17 10:17 ` [PATCH 9/9] startup: make debug printing of linker variables work again Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox