Aligning execution regions and input sections
There are situations when you want to align code and data sections. How you deal with them depends on whether you have access to the source code.
- Aligning when it is convenient for you to modify the source and recompile
-
When it is convenient for you to modify the original source code, you can align at compile time with the
__align(n)
keyword, for example. - Aligning when it is not convenient for you to modify the source and recompile
-
It might not be convenient for you to modify the source code for various reasons. For example, your build process might link the same object file into several images with different alignment requirements.
When it is not convenient for you to modify the source code, then you must use the following alignment specifiers in a scatter file:
ALIGNALL
Increases the section alignment of all the sections in an execution region, for example:
ER_DATA … ALIGNALL 8 { … ;selectors }
OVERALIGN
Increases the alignment of a specific section, for example:
ER_DATA … { *.o(.bar, OVERALIGN 8) … ;selectors }