Message ID | 1464263014-7622-1-git-send-email-daniel.schwierzeck@gmail.com |
---|---|
State | Superseded |
Delegated to: | Daniel Schwierzeck |
Headers | show |
On 05/26/2016 01:43 PM, Daniel Schwierzeck wrote: > Provide a default linker script for SPL binaries. Start address > and size of text section and BSS section are configurable. All > sections are arranged in a way that only relevant sections are > kept in the code section for maximum size reduction. All other > sections are kept but moved outside the code section to help > with debugging. > > Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> I'm worried this will blow when you enable DM in SPL, since DM uses special section(s) to keep the driver linked lists in. You'll probably need to add something like KEEP(*(SORT(.u_boot_list*))); somewhere in there. > --- > > arch/mips/cpu/u-boot-spl.lds | 83 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > create mode 100644 arch/mips/cpu/u-boot-spl.lds > > diff --git a/arch/mips/cpu/u-boot-spl.lds b/arch/mips/cpu/u-boot-spl.lds > new file mode 100644 > index 0000000..e18074b > --- /dev/null > +++ b/arch/mips/cpu/u-boot-spl.lds > @@ -0,0 +1,83 @@ > +/* > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +MEMORY { .spl_mem : ORIGIN = CONFIG_SPL_TEXT_BASE, \ > + LENGTH = CONFIG_SPL_MAX_SIZE } > +MEMORY { .bss_mem : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \ > + LENGTH = CONFIG_SPL_BSS_MAX_SIZE } > + > +OUTPUT_ARCH(mips) > +ENTRY(_start) > +SECTIONS > +{ > + . = 0x00000000; > + > + . = ALIGN(4); > + .text : { > + *(.text*) > + } > .spl_mem > + > + . = ALIGN(4); > + .rodata : { > + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) > + } > .spl_mem > + > + . = ALIGN(4); > + .data : { > + *(SORT_BY_ALIGNMENT(.data*)) > + *(SORT_BY_ALIGNMENT(.sdata*)) > + } > .spl_mem > + > + . = ALIGN(4); > + __image_copy_end = .; > + > + .bss (NOLOAD) : { > + __bss_start = .; > + *(.bss*) > + *(.sbss*) > + *(COMMON) > + . = ALIGN(4); > + __bss_end = .; > + } > .bss_mem > + > + .rel.dyn (NOLOAD) : { > + *(.rel.dyn) > + } > + > + .dynsym : { > + *(.dynsym) > + } > + > + .dynbss : { > + *(.dynbss) > + } > + > + .dynstr : { > + *(.dynstr) > + } > + > + .dynamic : { > + *(.dynamic) > + } > + > + .plt : { > + *(.plt) > + } > + > + .interp : { > + *(.interp) > + } > + > + .gnu : { > + *(.gnu*) > + } > + > + .MIPS.stubs : { > + *(.MIPS.stubs) > + } > + > + .hash : { > + *(.hash) > + } > +} >
Am 26.05.2016 um 14:08 schrieb Marek Vasut: > On 05/26/2016 01:43 PM, Daniel Schwierzeck wrote: >> Provide a default linker script for SPL binaries. Start address >> and size of text section and BSS section are configurable. All >> sections are arranged in a way that only relevant sections are >> kept in the code section for maximum size reduction. All other >> sections are kept but moved outside the code section to help >> with debugging. >> >> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> > > I'm worried this will blow when you enable DM in SPL, since DM uses > special section(s) to keep the driver linked lists in. You'll probably > need to add something like KEEP(*(SORT(.u_boot_list*))); somewhere in > there. > why should this blow? But you are right, u_boot_list is missing.
On 05/26/2016 02:42 PM, Daniel Schwierzeck wrote: > > > Am 26.05.2016 um 14:08 schrieb Marek Vasut: >> On 05/26/2016 01:43 PM, Daniel Schwierzeck wrote: >>> Provide a default linker script for SPL binaries. Start address >>> and size of text section and BSS section are configurable. All >>> sections are arranged in a way that only relevant sections are >>> kept in the code section for maximum size reduction. All other >>> sections are kept but moved outside the code section to help >>> with debugging. >>> >>> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> >> >> I'm worried this will blow when you enable DM in SPL, since DM uses >> special section(s) to keep the driver linked lists in. You'll probably >> need to add something like KEEP(*(SORT(.u_boot_list*))); somewhere in >> there. >> > > why should this blow? Because the u-boot driver list will be discarded by linker and that will lead either to linker complaining about it or scary bugs at runtime. But you are right, u_boot_list is missing. > :)
diff --git a/arch/mips/cpu/u-boot-spl.lds b/arch/mips/cpu/u-boot-spl.lds new file mode 100644 index 0000000..e18074b --- /dev/null +++ b/arch/mips/cpu/u-boot-spl.lds @@ -0,0 +1,83 @@ +/* + * SPDX-License-Identifier: GPL-2.0+ + */ + +MEMORY { .spl_mem : ORIGIN = CONFIG_SPL_TEXT_BASE, \ + LENGTH = CONFIG_SPL_MAX_SIZE } +MEMORY { .bss_mem : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \ + LENGTH = CONFIG_SPL_BSS_MAX_SIZE } + +OUTPUT_ARCH(mips) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : { + *(.text*) + } > .spl_mem + + . = ALIGN(4); + .rodata : { + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) + } > .spl_mem + + . = ALIGN(4); + .data : { + *(SORT_BY_ALIGNMENT(.data*)) + *(SORT_BY_ALIGNMENT(.sdata*)) + } > .spl_mem + + . = ALIGN(4); + __image_copy_end = .; + + .bss (NOLOAD) : { + __bss_start = .; + *(.bss*) + *(.sbss*) + *(COMMON) + . = ALIGN(4); + __bss_end = .; + } > .bss_mem + + .rel.dyn (NOLOAD) : { + *(.rel.dyn) + } + + .dynsym : { + *(.dynsym) + } + + .dynbss : { + *(.dynbss) + } + + .dynstr : { + *(.dynstr) + } + + .dynamic : { + *(.dynamic) + } + + .plt : { + *(.plt) + } + + .interp : { + *(.interp) + } + + .gnu : { + *(.gnu*) + } + + .MIPS.stubs : { + *(.MIPS.stubs) + } + + .hash : { + *(.hash) + } +}
Provide a default linker script for SPL binaries. Start address and size of text section and BSS section are configurable. All sections are arranged in a way that only relevant sections are kept in the code section for maximum size reduction. All other sections are kept but moved outside the code section to help with debugging. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> --- arch/mips/cpu/u-boot-spl.lds | 83 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 arch/mips/cpu/u-boot-spl.lds