* [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts
@ 2019-01-06 19:42 Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 1/2] MIPS: optimize and fix ELF sections Daniel Schwierzeck
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Daniel Schwierzeck @ 2019-01-06 19:42 UTC (permalink / raw)
To: u-boot
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
--
2.20.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 1/2] MIPS: optimize and fix ELF sections
2019-01-06 19:42 [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Daniel Schwierzeck
@ 2019-01-06 19:42 ` Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds Daniel Schwierzeck
2019-01-07 21:14 ` [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Ezequiel Garcia
2 siblings, 0 replies; 7+ messages in thread
From: Daniel Schwierzeck @ 2019-01-06 19:42 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
arch/mips/cpu/u-boot-spl.lds | 100 +++++++++++++++++++++------------
arch/mips/cpu/u-boot.lds | 104 +++++++++++++++++++++++------------
2 files changed, 136 insertions(+), 68 deletions(-)
diff --git a/arch/mips/cpu/u-boot-spl.lds b/arch/mips/cpu/u-boot-spl.lds
index 1273b74983..be194d314b 100644
--- a/arch/mips/cpu/u-boot-spl.lds
+++ b/arch/mips/cpu/u-boot-spl.lds
@@ -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)
}
}
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds
index fd0f1b5d4f..86496737d3 100644
--- a/arch/mips/cpu/u-boot.lds
+++ b/arch/mips/cpu/u-boot.lds
@@ -68,39 +68,75 @@ SECTIONS
__bss_end = .;
}
- .dynsym _end : {
- *(.dynsym)
- }
-
- .dynbss : {
- *(.dynbss)
- }
-
- .dynstr : {
- *(.dynstr)
- }
-
- .dynamic : {
- *(.dynamic)
- }
-
- .plt : {
- *(.plt)
- }
-
- .interp : {
- *(.interp)
- }
-
- .gnu : {
- *(.gnu*)
- }
-
- .MIPS.stubs : {
- *(.MIPS.stubs)
- }
-
- .hash : {
- *(.hash)
+ /* These mark the ABI of U-Boot for debuggers. */
+ .mdebug.abi32 : {
+ KEEP(*(.mdebug.abi32))
+ }
+ .mdebug.abi64 : {
+ KEEP(*(.mdebug.abi64))
+ }
+
+ /* 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.*)
+ }
+ .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)
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds
2019-01-06 19:42 [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 1/2] MIPS: optimize and fix ELF sections Daniel Schwierzeck
@ 2019-01-06 19:42 ` Daniel Schwierzeck
2019-01-06 20:03 ` Marek Vasut
2019-01-07 21:14 ` [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Ezequiel Garcia
2 siblings, 1 reply; 7+ messages in thread
From: Daniel Schwierzeck @ 2019-01-06 19:42 UTC (permalink / raw)
To: u-boot
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 <daniel.schwierzeck@gmail.com>
---
- 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
diff --git a/arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds b/arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds
deleted file mode 100644
index 347cabc450..0000000000
--- a/arch/mips/mach-jz47xx/jz4780/u-boot-spl.lds
+++ /dev/null
@@ -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)
- }
-}
diff --git a/configs/ci20_mmc_defconfig b/configs/ci20_mmc_defconfig
index c1b1c3f7e9..9602c8c6fe 100644
--- a/configs/ci20_mmc_defconfig
+++ b/configs/ci20_mmc_defconfig
@@ -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
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds
2019-01-06 19:42 ` [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds Daniel Schwierzeck
@ 2019-01-06 20:03 ` Marek Vasut
2019-01-06 20:56 ` Daniel Schwierzeck
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2019-01-06 20:03 UTC (permalink / raw)
To: u-boot
On 1/6/19 8:42 PM, Daniel Schwierzeck wrote:
> 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 <daniel.schwierzeck@gmail.com>
>
> ---
> - tested with MMC boot on CI20 rev1 board
Is the SPL size the same still ? :)
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds
2019-01-06 20:03 ` Marek Vasut
@ 2019-01-06 20:56 ` Daniel Schwierzeck
2019-01-07 6:23 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Schwierzeck @ 2019-01-06 20:56 UTC (permalink / raw)
To: u-boot
Am 06.01.19 um 21:03 schrieb Marek Vasut:
> On 1/6/19 8:42 PM, Daniel Schwierzeck wrote:
>> 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 <daniel.schwierzeck@gmail.com>
>>
>> ---
>> - tested with MMC boot on CI20 rev1 board
>
> Is the SPL size the same still ? :)
>
it's 24 Bytes smaller with kernel.org gcc 7.3 :D
--
- Daniel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds
2019-01-06 20:56 ` Daniel Schwierzeck
@ 2019-01-07 6:23 ` Marek Vasut
0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2019-01-07 6:23 UTC (permalink / raw)
To: u-boot
On 1/6/19 9:56 PM, Daniel Schwierzeck wrote:
>
>
> Am 06.01.19 um 21:03 schrieb Marek Vasut:
>> On 1/6/19 8:42 PM, Daniel Schwierzeck wrote:
>>> 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 <daniel.schwierzeck@gmail.com>
>>>
>>> ---
>>> - tested with MMC boot on CI20 rev1 board
>>
>> Is 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.
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts
2019-01-06 19:42 [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 1/2] MIPS: optimize and fix ELF sections Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds Daniel Schwierzeck
@ 2019-01-07 21:14 ` Ezequiel Garcia
2 siblings, 0 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2019-01-07 21:14 UTC (permalink / raw)
To: u-boot
On Sun, 2019-01-06 at 20:42 +0100, Daniel Schwierzeck wrote:
> 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:
Tested-by: Ezequiel Garcia <ezequiel@collabora.com>
Thanks a lot!
> 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-07 21:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-06 19:42 [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 1/2] MIPS: optimize and fix ELF sections Daniel Schwierzeck
2019-01-06 19:42 ` [U-Boot] [PATCH 2/2] MIPS: jz47xx: remove custom u-boot-spl.lds Daniel Schwierzeck
2019-01-06 20:03 ` Marek Vasut
2019-01-06 20:56 ` Daniel Schwierzeck
2019-01-07 6:23 ` Marek Vasut
2019-01-07 21:14 ` [U-Boot] [PATCH 0/2] MIPS: cleanup/optimise linker scripts Ezequiel Garcia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox