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

Ulf Samuelsson binutils@emagii.com
Mon Feb 13 15:54:58 GMT 2023


Den 2023-02-13 kl. 13:33, skrev Jan Beulich:
> 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.

Yes, but each customer has their own header format and they
do not want to make changes to binutils.

Typically, the image is downloaded and checked by a bootloader
which will receive a binary.

You also want to be able to download it with a debugger during development.

I do not think you need a new binary format for this.
Simplifying the creation of the header file is good enough for me.

/Ulf

> Jan


More information about the Binutils mailing list