Patchwork [U-Boot,v2,5/9] x86: Rearrange the output input to remove BSS

login
register
mail settings
Submitter Simon Glass
Date March 1, 2013, 5:26 a.m.
Message ID <1362115578-12165-5-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/224232/
State Accepted, archived
Delegated to: Simon Glass
Headers show

Comments

Simon Glass - March 1, 2013, 5:26 a.m.
At present BSS data is including in the image, which wastes binary space.
Remove it by rearranging the sections so that BSS is last.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None

 arch/x86/cpu/u-boot.lds | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Patch

diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index 8e185f3..54f2fb7 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -46,9 +46,6 @@  SECTIONS
 	.data : { *(.data*) }
 
 	. = ALIGN(4);
-	.dynsym : { *(.dynsym*) }
-
-	. = ALIGN(4);
 	.hash : { *(.hash*) }
 
 	. = ALIGN(4);
@@ -58,10 +55,7 @@  SECTIONS
 	__data_end = .;
 
 	. = ALIGN(4);
-	__bss_start = ABSOLUTE(.);
-	.bss (NOLOAD) : { *(.bss) }
-	. = ALIGN(4);
-	__bss_end = ABSOLUTE(.);
+	.dynsym : { *(.dynsym*) }
 
 	. = ALIGN(4);
 	__rel_dyn_start = .;
@@ -70,6 +64,17 @@  SECTIONS
 	. = ALIGN(4);
 	_end = .;
 
+	. = ALIGN(4);
+
+	__end = .;
+	.bss __rel_dyn_start (OVERLAY) : {
+		__bss_start = .;
+		*(.bss)
+		*(COM*)
+		. = ALIGN(4);
+		__bss_end = .;
+	}
+
 	/DISCARD/ : { *(.dynstr*) }
 	/DISCARD/ : { *(.dynamic*) }
 	/DISCARD/ : { *(.plt*) }