Message ID | 1360593142-1606-1-git-send-email-daniel.schwierzeck@gmail.com |
---|---|
State | Accepted |
Delegated to: | Daniel Schwierzeck |
Headers | show |
2013.02.11. 15:32 keltezéssel, Daniel Schwierzeck írta: > From: Gabor Juhos <juhosg@openwrt.org> > > 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> > --- > Changes since v1: > - add back the .deadcode section (see code comment for explanation) Thanks! -Gabor For the record: the qemu_mips{,el,64,64el} and the qi_lb60 images (compiled from the updated mips/reloc branch) are working under qemu: U-Boot 2013.01-00178-gc27fe73 (Feb 11 2013 - 15:46:40) Board: Qemu -M mips CPU: 24Kf proc_id=0x19300 DRAM: 128 MiB ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB Flash: 0 Bytes *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: NE2000 Hit any key to stop autoboot: 0 qemu-mips # --- U-Boot 2013.01-00178-gc27fe73 (Feb 11 2013 - 15:47:29) Board: Qemu -M mips CPU: 24Kf proc_id=0x19300 DRAM: 128 MiB ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB Flash: 0 Bytes *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: NE2000 Hit any key to stop autoboot: 0 qemu-mipsel # --- U-Boot 2013.01-00178-gc27fe73 (Feb 11 2013 - 15:48:16) Board: Qemu -M mips CPU: 20Kc proc_id=0x182a0 DRAM: 128 MiB ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB Flash: 0 Bytes *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: NE2000 Hit any key to stop autoboot: 0 qemu-mips64 # --- U-Boot 2013.01-00178-gc27fe73 (Feb 11 2013 - 15:48:55) Board: Qemu -M mips CPU: 20Kc proc_id=0x182a0 DRAM: 128 MiB ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB Flash: 0 Bytes *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: NE2000 Hit any key to stop autoboot: 0 qemu-mips64el # --- U-Boot 2013.01-00178-gc27fe73 (Feb 11 2013 - 15:49:34) Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed 336 MHz) DRAM: 32 MiB NAND: No NAND device found!!! 0 MiB No Valid Environment Area found No Valid Redundant Environment Area found *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Hit any key to stop autoboot: 0 no devices available Wrong Image Format for bootm command ERROR: can't get kernel image! NanoNote#
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) + } }