'LD linker script, get current position of LOAD address

In linker scripts, I can get the LMA of a section like this

 .got : ALIGN(4)
{
    __global_offset_table_flash_start__ = LOADADDR(.got) ;
    ...
} >SRAM_DTC AT>PROGRAM_FLASH

When I use

 .got : ALIGN(4)
{
    __global_offset_table_flash_start__ = . ;
    ...
} >SRAM_DTC AT>PROGRAM_FLASH

or

 .got : ALIGN(4)
{
    __global_offset_table_flash_start__ = ABSOLUTE(.) ;
    ...
} >SRAM_DTC AT>PROGRAM_FLASH

it will give the VIRTUAL memory address. Where I thought the ABSOLUTE would give the LMA, but it doesn't.

Is there also a way to get the current LOAD memory address for . ?



Solution 1:[1]

Only workaround I can figure out is adding a section which only goes to flash.

.dummy : 
{
   __global_offset_table_flash_start__ = .;
    
} > PROGRAM_FLASH

As far as I can find in the documentation, there is no way to get the "current" load address

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bas