[patch, avr] PR31124: Support rodata in flash for more AVR devices

Georg-Johann Lay avr@gjlay.de
Mon Dec 11 18:33:26 GMT 2023


Am 11.12.23 um 16:41 schrieb Nick Clifton:
> Hi Johann,
> 
>> This patch adds two new emulations in order to support rodata in
>> flash for more devices.
> 
> Patch approved - please apply.  (Or let me know and I will apply it for 
> you).

Hi Nick,

I do not have write access to Binutils, at least I never asked for it.

>> What I am unsure about 
> 
> Err - didn't you write this patch ?

I did.  But even after studying the documentation many things are
not 100 clear.

>> is the ABSOLUTE in avrxmega2_flmap.x:
>>
>>    .rodata  __rodata_start   :  AT (__rodata_load_start)
>>    {
>>      ...
>>       __rodata_end = ABSOLUTE(.) ;
>>    }  > rodata
>>
>> No other places in the ld scripts use ABSOLUTE, e.g. for __data_end in:
>>
>>    .data :
>>    {
>>       ...
>>       PROVIDE (__data_end = .) ;
>>    }  > data AT> text
> 
> The difference is, presumably, that the symbols are going to be used
> in different ways.  The __data_end symbol, for example is more like a
> size-of-the-data-section symbol whereas the __rodata_end symbol is more
> of a no-more-read-only-data-after-this-address kind of symbol.
> 
> Cheers
>    Nick

The startup code copies __data_load_start...__data_load_end-1 to
__data_start...__data_end-1, so the date size is the difference.

There is currently no use for the rodata symbols; I added them in
case a user wants to compute CRC etc.

The hardware has the assertion that __rodata_load_start - __rodata_start
must be 0 mod 0x8000.  And it should always be the case that
__rodata_load_end - __rodata_load_start = __rodata_end - __rodata_start.
I am just unsure if that's always the case, e.g. when the user starts
moving stuff around with objcopy or whatnot.

I tested with -Ttext; and when .text reaches into .rodata, then both
LMA and VMA are shifted in sync like it's supposed to be.


Johann


More information about the Binutils mailing list