RFC: generating a header using the linker (ASCII, ASCIZ commands)

Jan Beulich jbeulich@suse.com
Mon Feb 13 12:33:39 GMT 2023


On 13.02.2023 12:12, Ulf Samuelsson via Binutils wrote:
> Den 2023-02-13 kl. 11:09, skrev Nick Clifton:
>>> One of the problems was that we wanted to generate a header,
>>> and for various reasons, it was desirable to have the linker generate 
>>> the header
>>
>> From the sound of what you have written below it would be
>> easier to use the assembler to create the header and then just
>> include it as another object file when you perform your link.
>> That together with a customised linker script should allow you
>> to achieve what you want without having to add new code to the
>> linker.
> 
> One of the problems is time of build.
> The header should contain the time when things are linked together, not 
> when things are compiled.
> 
> Another is that one of the fields is the size of the application which 
> is only known at link time.
> 
> Doing things in the linker seems to be the cleanest way.
> 
> We would probably have the header is in a separate file which is 
> included in the linker script.

Otherwise I would be wondering if you're not really defining a new binary
format (potentially an extension of an existing one), at which point it
might be best to also treat it as such in binutils / ld.

Jan


More information about the Binutils mailing list