MIPS: cleanup/optimise linker scripts
cover MIPS: cleanup/optimise linker scripts
Cleanup and optimise MIPS linker scripts and align them more with Linux.
Switch the CI20 board from the custom SPL linker script to the generic MIPS SPL linker script.
Daniel Schwierzeck (2):
MIPS: optimize and fix ELF sections
MIPS: jz47xx: remove custom u-boot-spl.lds
arch/mips/cpu/u-boot-spl.lds | 100 ++++++++++++------- arch/mips/cpu/u-boot.lds | 104 +++++++++++++------- arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds | 50 ---------- configs/ci20_mmc_defconfig | 1 - 4 files changed, 136 insertions(+), 119 deletions(-) delete mode 100644 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds
Signature · 1 line
2.20.1
PATCH 1/2 MIPS: optimize and fix ELF sections
Discard ABI related sections which are not required for debugging. Rearrange debug sections similar to Linux. Remove the remaining explicitely specified sections in the unused part because those sections are not created anymore or because the linker puts them by default at the end of the ELF binary.
---
arch/mips/cpu/u-boot-spl.lds | 100 +++++++++++++++++++++------------ arch/mips/cpu/u-boot.lds | 104 +++++++++++++++++++++++------------ 2 files changed, 136 insertions(+), 68 deletions(-)
arch/mips/cpu/u-boot-spl.lds +66 -34
@@ -46,43 +46,75 @@ SECTIONS __bss_end = .; } > .bss_mem - .rel.dyn (NOLOAD) : { - *(.rel.dyn) + /* These mark the ABI of U-Boot for debuggers. */ + .mdebug.abi32 : { + KEEP(*(.mdebug.abi32)) } - - .dynsym : { - *(.dynsym) - } - - .dynbss : { - *(.dynbss) - } - - .dynstr : { - *(.dynstr) - } - - .dynamic : { - *(.dynamic) + .mdebug.abi64 : { + KEEP(*(.mdebug.abi64)) } - .plt : { - *(.plt) + /* This is the MIPS specific mdebug section. */ + .mdebug : { *(.mdebug) } + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + + /* + * DWARF debug sections. + * Symbols in the DWARF debugging sections are relative to + * the beginning of the section so we begin them at 0. + */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { + *(.debug_info + .gnu.linkonce.wi.*) } - - .interp : { - *(.interp) - } - - .gnu : { - *(.gnu*) - } - - .MIPS.stubs : { - *(.MIPS.stubs) - } - - .hash : { - *(.hash) + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + .debug_pubtypes 0 : { *(.debug_pubtypes) } + /* DWARF 3 */ + .debug_ranges 0 : { *(.debug_ranges) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* GNU DWARF 2 extensions */ + .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } + .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } + /* DWARF 4 */ + .debug_types 0 : { *(.debug_types) } + /* DWARF 5 */ + .debug_macro 0 : { *(.debug_macro) } + .debug_addr 0 : { *(.debug_addr) } + + /DISCARD/ : { + /* ABI crap starts here */ + *(.MIPS.abiflags) + *(.MIPS.options) + *(.options) + *(.pdr) + *(.reginfo) + *(.eh_frame) } }
arch/mips/cpu/u-boot.lds +70 -34
109 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 2/2 MIPS: jz47xx: remove custom u-boot-spl.lds
In reply to Daniel SchwierzeckThere is no real difference between the generic variant and the custom variant except that the generic variant is more optimised. This also saves 24 Bytes in the SPL binary.
---
- tested with MMC boot on CI20 rev1 board
arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds | 50 --------------------- configs/ci20_mmc_defconfig | 1 - 2 files changed, 51 deletions(-) delete mode 100644 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds
arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds deleted +0 -50
@@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ - -MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ - LENGTH = CONFIG_SPL_MAX_SIZE } -MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \ - LENGTH = CONFIG_SPL_BSS_MAX_SIZE } - -OUTPUT_ARCH(mips) -ENTRY(_start) -SECTIONS -{ - .text : - { - __image_copy_start = .; - arch/mips/mach-jz47xx/start.o (.text*) - *(.text*) - } >.sram - - . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram - - . = ALIGN(4); - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram - - . = ALIGN(4); - __image_copy_end = .; - - .bss : { - . = ALIGN(4); - __bss_start = .; - *(.sbss.*) - *(.bss.*) - *(COMMON) - . = ALIGN(4); - __bss_end = .; - } >.sdram - - /DISCARD/ : { - *(.dynbss) - *(.dynstr) - *(.dynamic) - *(.interp) - *(.hash) - *(.gnu.*) - *(.plt) - *(.got.plt) - *(.rel.plt) - *(.rel.dyn) - } -}
configs/ci20_mmc_defconfig +0 -1
@@ -1,5 +1,4 @@ CONFIG_MIPS=y -CONFIG_SPL_LDSCRIPT="arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds" CONFIG_SYS_TEXT_BASE=0x80010000 CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y
Signature · 1 line
2.20.1
PATCH 2/2 MIPS: jz47xx: remove custom u-boot-spl.lds
Quoted 8 lines · Daniel Schwierzeck
There is no real difference between the generic variant and the custom variant except that the generic variant is more optimised. This also saves 24 Bytes in the SPL binary.
Signed-off-by Daniel Schwierzeck <[email protected]>---
- tested with MMC boot on CI20 rev1 board
Is the SPL size the same still ? :)
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/2 MIPS: jz47xx: remove custom u-boot-spl.lds
Am 06.01.19 um 21:03 schrieb Marek Vasut:
Quoted 5 lines · Daniel Schwierzeck
Quoted 4 lines
There is no real difference between the generic variant and the custom variant except that the generic variant is more optimised. This also saves 24 Bytes in the SPL binary.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Daniel Schwierzeck <[email protected]>---
- tested with MMC boot on CI20 rev1 boardIs the SPL size the same still ? :)
it's 24 Bytes smaller with kernel.org gcc 7.3 :D
Signature · 1 line
- Daniel
PATCH 2/2 MIPS: jz47xx: remove custom u-boot-spl.lds
Quoted 10 lines · Daniel Schwierzeck
Am 06.01.19 um 21:03 schrieb Marek Vasut:
Quoted 7 lines · Daniel Schwierzeck
Quoted 6 lines
There is no real difference between the generic variant and the custom variant except that the generic variant is more optimised. This also saves 24 Bytes in the SPL binary.
Signed-off-by Daniel Schwierzeck <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
---
- tested with MMC boot on CI20 rev1 boardIs the SPL size the same still ? :)
it's 24 Bytes smaller with kernel.org gcc 7.3 :D
That's great, I wonder where that came from.
Signature · 2 lines
Best regards, Marek Vasut
cover MIPS: cleanup/optimise linker scripts
In reply to Daniel SchwierzeckQuoted 7 lines · Daniel Schwierzeck
Cleanup and optimise MIPS linker scripts and align them more with Linux.
Switch the CI20 board from the custom SPL linker script to the generic MIPS SPL linker script.
For both patches:
Thanks a lot!
Quoted 11 lines
Daniel Schwierzeck (2):
MIPS: optimize and fix ELF sections
MIPS: jz47xx: remove customu-boot-spl.ldsarch/mips/cpu/u-boot-spl.lds | 100 ++++++++++++------- arch/mips/cpu/u-boot.lds | 104 +++++++++++++------- arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds | 50 ---------- configs/ci20_mmc_defconfig | 1 - 4 files changed, 136 insertions(+), 119 deletions(-) delete mode 100644 arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds