9.2.2 Referencing C/C++ Program External Names (Variables and C Functions) from Assembly-Language Programs

A C/C++ program can define external variable names (without an underscore (_)).

In an assembly-language program, .GLB is used to declare an external name (preceded by an underscore).

[Example of C source]

int a;

 

[Example of assembly-language source]

     .GLB _a
     .SECTION P,CODE
     MOV.L #A_a,R1
     MOV.L [R1],R2
     ADD #1,R2
     MOV.L R2,[R1]
     RTS
     .SECTION D,ROMDATA,ALIGN=4
A_a: .LWORD _a
     .END