public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] MIPS: provide a default u-boot-spl.lds
Date: Fri, 27 May 2016 14:44:59 +0200	[thread overview]
Message-ID: <5748414B.1000805@denx.de> (raw)
In-Reply-To: <57481B56.7030603@gmail.com>

On 05/27/2016 12:03 PM, Daniel Schwierzeck wrote:
> 
> 
> Am 26.05.2016 um 17:17 schrieb Marek Vasut:
>> On 05/26/2016 03:28 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>
>>>
>>> ---
>>>
>>> Changes in v2:
>>> - add missing section .u_boot_list
>>>
>>>  arch/mips/config.mk          |  5 ++-
>>>  arch/mips/cpu/u-boot-spl.lds | 90 ++++++++++++++++++++++++++++++++++++++++++++
>>>  2 files changed, 93 insertions(+), 2 deletions(-)
>>>  create mode 100644 arch/mips/cpu/u-boot-spl.lds
>>>
>>> diff --git a/arch/mips/config.mk b/arch/mips/config.mk
>>> index 609a998..dcd3460 100644
>>> --- a/arch/mips/config.mk
>>> +++ b/arch/mips/config.mk
>>> @@ -65,7 +65,7 @@ else
>>>  PF_ABICALLS			:= -mabicalls
>>>  PF_PIC				:= -fpic
>>>  PF_PIE				:= -pie
>>> -PF_OBJCOPY			:= -j .got -j .u_boot_list -j .rel.dyn -j .padding
>>> +PF_OBJCOPY			:= -j .got -j .rel.dyn -j .padding
>>>  PF_OBJCOPY			+= -j .dtb.init.rodata
>>>  endif
>>>  
>>> @@ -74,4 +74,5 @@ PLATFORM_CPPFLAGS		+= -msoft-float
>>>  PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib
>>>  PLATFORM_RELFLAGS		+= -ffunction-sections -fdata-sections
>>>  LDFLAGS_FINAL			+= --gc-sections $(PF_PIE)
>>> -OBJCOPYFLAGS			+= -j .text -j .rodata -j .data $(PF_OBJCOPY)
>>> +OBJCOPYFLAGS			+= -j .text -j .rodata -j .data -j .u_boot_list
>>> +OBJCOPYFLAGS			+= $(PF_OBJCOPY)
>>> diff --git a/arch/mips/cpu/u-boot-spl.lds b/arch/mips/cpu/u-boot-spl.lds
>>> new file mode 100644
>>> index 0000000..07004ea
>>> --- /dev/null
>>> +++ b/arch/mips/cpu/u-boot-spl.lds
>>> @@ -0,0 +1,90 @@
>>> +/*
>>> + * 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
>>> +
>>> +#ifdef CONFIG_SPL_DM
>>
>> Is the ifdef really necessary ? I think if the list is empty, the
>> u_boot_list will just be an zero-length symbol and since both this and
>> the image_copy_end are 4-byte aligned, there will be no wasted space.
> 
> yes, I also tested it with your with your CI20 patches. If I disable
> CONFIG_SPL_DM, there still is u_boot_list entry from the MMC driver
> which would waste 120 Bytes.

Awwwww, precious 120 bytes. Ok, keep this as is:

Acked-by: Marek Vasut <marex@denx.de>

>>> +	. = ALIGN(4);
>>> +	.u_boot_list : {
>>> +		KEEP(*(SORT(.u_boot_list*)));
>>> +	} > .spl_mem
>>> +#endif
>>> +
>>> +	. = 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)
>>> +	}
>>> +}
>>>
>>
>>
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-05-27 12:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 11:43 [U-Boot] [PATCH] MIPS: provide a default u-boot-spl.lds Daniel Schwierzeck
2016-05-26 12:08 ` Marek Vasut
2016-05-26 12:42   ` Daniel Schwierzeck
2016-05-26 12:47     ` Marek Vasut
2016-05-26 13:28 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
2016-05-26 15:17   ` Marek Vasut
2016-05-27 10:03     ` Daniel Schwierzeck
2016-05-27 12:44       ` Marek Vasut [this message]
2016-05-30  9:48   ` Daniel Schwierzeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5748414B.1000805@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox