SLAU131V October 2004 – February 2020
Consider an output section specification within a SECTIONS directive:
outsect:
{
s1.c.obj(.text)
end_of_s1 = .;
start_of_s2 = .;
s2.c.obj(.text)
end_of_s2 = .;
}
This can be rewritten using the START and END operators as follows:
outsect:
{
s1.c.obj(.text) { END(end_of_s1) }
s2.c.obj(.text) { START(start_of_s2), END(end_of_s2) }
}
The values of end_of_s1 and end_of_s2 will be the same as if you had used the dot operator in the original example, but start_of_s2 would be defined after any necessary padding that needs to be added between the two .text sections. Remember that the dot operator would cause start_of_s2 to be defined before any necessary padding is inserted between the two input sections.
The syntax for using these operators in association with input sections calls for braces { } to enclose the operator list. The operators in the list are applied to the input item that occurs immediately before the list.