summaryrefslogtreecommitdiff
path: root/arch/mips/cpu/u-boot.lds
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-02-12 22:22:13 +0100
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2013-02-12 22:22:13 +0100
commit0ba8926e08bdabba681384ba3ea8476eda68c141 (patch)
tree7aa6333005ed3cd15fe111c6e158a74aa83328c4 /arch/mips/cpu/u-boot.lds
parent28875e2c4731296ee7ed645d07f1c28c0301f1c4 (diff)
downloadu-boot-imx-0ba8926e08bdabba681384ba3ea8476eda68c141.zip
u-boot-imx-0ba8926e08bdabba681384ba3ea8476eda68c141.tar.gz
u-boot-imx-0ba8926e08bdabba681384ba3ea8476eda68c141.tar.bz2
MIPS: u-boot.lds: add relocation specific sections
This section contain the table needed for dynamic relocation. Also provide symbols for the relocation code to access the table. Discard all sections which are not needed in the final ELF binary and U-Boot image. Section .dynsym cannot be discarded or GNU ld crashes otherwise. This section will be stripped by GNU objcpy in a later patch. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Diffstat (limited to 'arch/mips/cpu/u-boot.lds')
-rw-r--r--arch/mips/cpu/u-boot.lds42
1 files changed, 41 insertions, 1 deletions
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds
index 4cd983a..10513ab 100644
--- a/arch/mips/cpu/u-boot.lds
+++ b/arch/mips/cpu/u-boot.lds
@@ -70,7 +70,35 @@ SECTIONS
. = ALIGN(4);
__image_copy_end = .;
- .bss : {
+ .rel.dyn : {
+ __rel_dyn_start = .;
+ *(.rel.dyn)
+ __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);
+ }
+
+ .dynsym : {
+ *(.dynsym)
+ }
+
+ .bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.sbss.*)
*(.bss.*)
@@ -78,4 +106,16 @@ SECTIONS
. = ALIGN(4);
__bss_end = .;
}
+
+ /DISCARD/ : {
+ *(.dynbss)
+ *(.dynstr)
+ *(.dynamic)
+ *(.interp)
+ *(.hash)
+ *(.gnu.*)
+ *(.plt)
+ *(.got.plt)
+ *(.rel.plt)
+ }
}