I have been looking at some linker scripts for embedded ARM processors. In one of them, there's something like this (minimal example):
MEMORY {
REGION : ORIGIN = 0x1000, LENGTH = 0x1000
}
SECTIONS {
.text : {
/* ... */
. = 0x20;
/* ... */
} > MEMORY
}
This linker script states that the section .text
should go in the memory region REGION
, which starts at 0x1000
. However, within the section contents, the location is explicitly set to 0x20
.
Is this location assignment relative to the start of the region that the section is in? Or absolute? In general, how do regions and location assignments work together?