This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Strange behaviour of ld saving vma and lma infos into elf

The question concerns the vma and lma that can be expressed in the linker script with the keyword AT.

let’s take the following linker script:

I’d like you to put the attention on the .data and .bss sections:

I try to explain it in words: we are saying that .data has vma in RAM but lma in FLASH, instead .bss I expect it to have vma and lma identical and in RAM.

this is explained in 3.1 Basic Linker Script Concepts and in 3.6.8.2 Output Section LMA

I consider a very simple source file:

I build the elf with this makefile:

linker tells me:

and size tells me:

then I extract the information of vma and lma from the elf using objdump.

again I highlight .data and .bss (and also .text for comparison)

  • .text has vma and lma coinciding and in FLASH. I expected this
  • .data has vma in RAM and lma in FLASH. I expected this
  • .bss has vma in RAM and lma in FLASH as .data. I wasn’t expecting that.

why this unexpected behavior? What am I missing?

Is this a bug?

best regards
Max

0