A .SECTION directive defines a section in assembly source. This directive must precede its code or data.
Blackfin Code Example
.SECTION Library_Code_Space; /* Section Directive */
.GLOBAL _abs;
_abs:
R0 = ABS RO; /* take absolute value of input */
RTS;
_abs.end;
In this example, the assembler places the global symbol/label _abs and the code after the label into the input section Library_Code_Space, as it process this file into object code.
In the example, the linker knows what code is associated with the label _abs because it is delimited with the label _abs.end. For some linker features, especially unused secton elimination, the linker needs to be able to determine the end of code or data associated with a label. In assembly code, the end of a function data block can be marked with a label with the same name as the label at the start of the name with .end appeded to it. It is also possible to prepend a "." in which case the label will not appear in the symbol table which can make debugging easier.
Listing 1-1 shows uses of .end labels in assembly code.
start_label:
// code
start_label.end // marks end of code section
new_label:
// code
new_label.END // end label can be in upper case
one_entry: // function one_entry includes the code
// in second_entry
second_entry: // more code
.one_entry_end:
.second_entry.end; // prepended "." omits end label
// from the symbol table