Example using an external td symbol
Example of using an external TD symbol
-
/* This C module named td3.c */ long t_data; extern void mod_s(); main() { t_data = 234; mod_s(); printf("t_data is %d\n", t_data); }
- The following is the assembler source for module mod3.s:
.file "mod3.s" .csect .mod_s[PR] .globl .mod_s[PR] .set RTOC, 2 l 5, t_data[TD](RTOC) # Now GPR5 contains the # t_data value ai 5,5,14 stu 5, t_data[TD](RTOC) br .toc .extern t_data[TD] # t_data is a external symbol
- The following commands assemble and compile the source programs
into an executable td3:
./as -o mod3.o mod3.s cc -o td3 td3.c mod3.o
- Running td3 prints the following:
t_data is 248