Input Section Directives in Assembly Code

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值