[U-Boot] [RFC 1/3] MIPS: add .dyn.rel section to u-boot.lds

Gabor Juhos juhosg at openwrt.org
Sun Feb 3 10:26:20 CET 2013


This section contain the table needed for dynamic
relocation. Also provide symbols for the relocation
code to access the table.

Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck at googlemail.com>
---
 arch/mips/cpu/u-boot.lds |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds
index 58a49b2..3d9d82a 100644
--- a/arch/mips/cpu/u-boot.lds
+++ b/arch/mips/cpu/u-boot.lds
@@ -70,11 +70,36 @@ SECTIONS
 	uboot_end_data = .;
 
 	. = ALIGN(4);
+	.rel.dyn : {
+		__rel_dyn_start = .;
+		*(.rel*)
+		__rel_dyn_end = .;
+	}
+
+	.deadcode : {
+		/*
+		 * Workaround for a binutils feature (or bug?).
+		 *
+		 * The GNU ld from binutils puts the dynamic relocation
+		 * entries into the .rel.dyn section. Sometimes it
+		 * allocates more dynamic relocation entries than it needs
+		 * and the unused slots are set to R_MIPS_NONE entries.
+		 *
+		 * However the size of the .rel.dyn section in the ELF
+		 * section header does not cover the unused entries, so
+		 * objcopy removes those during stripping.
+		 *
+		 * Create a small section here to avoid that.
+		 */
+		LONG(0xffffffff);
+	}
+
+	. = ALIGN(4);
 	.sbss : {
 		*(.sbss*)
 	}
 
-	.bss : {
+	.bss __rel_dyn_start (OVERLAY) : {
 		*(.bss*)
 		. = ALIGN(4);
 	}
-- 
1.7.10



More information about the U-Boot mailing list