This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Comments requested for proposed for ld scripting language extension
- From: Tristan Gingold <gingold at adacore dot com>
- To: Catherine Moore <clm at codesourcery dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 29 Apr 2011 09:35:03 +0200
- Subject: Re: Comments requested for proposed for ld scripting language extension
- References: <4DB99A38.1010801@codesourcery.com>
On Apr 28, 2011, at 6:47 PM, Catherine Moore wrote:
[...]
> What I would like to do is add an extension to the scripting language. Something like this:
>
> MEMORY
> {
> ram (rwx) : ORIGIN = 0x100000, LENGTH = 144M
> }
>
> SECTIONS
> {
> .text : WITHOUT_FLAGS (SHF_PPC_VLE)
> {
> *(.text .text.* .gnu.linkonce.t.*)
> } >ram
> .text_vle : WITH_FLAGS (SHF_PPC_VLE)
> {
> *(.text .text.* .gnu.linkonce.t.*)
> } >ram
> }
>
> map_input_to_output_sections would then walk the input sections for those sections with an optional "FLAG" marker. A callback would be introduced that would examine the ELF header flags for the input sections and gather only those that met the criteria.
>
> I realize that this is an ELF-centric proposal. Although it could be extended to include other object formats, I haven't given that aspect alot of thought.
>
> Before I spend time on development, I'd like to solicit comments ahead of time. How do the maintainers and others feel about this plan?
I had similar thoughts but for the VMS format, where the section names are less important than their flags.
I think your proposal isn't that ELF-centric: the flags could be a mix of bfd ones (either from section or from file) and target
specific ones.
I also think that you could make the design a little bit generic and allow boolean negation. What about something like:
.text : FLAGS (-SHF_PPC_VLE)
{
*(.text .text.* .gnu.linkonce.t.*)
} >ram
.text_vle : FLAGS (+SHF_PPC_VLE)
{
*(.text .text.* .gnu.linkonce.t.*)
} >ram
That would make the life easier if we later want to add boolean operators (and, or).
Finally I wonder if the flags shouldn't be in the input section part, in order to make this feature even more generic:
.text :
{
*(.text .text.* .gnu.linkonce.t.*) FLAGS (-SHF_PPC_VLE)
} >ram
Tristan.