SPARC Assembly Language Reference Manual

Exit Print View

Updated: July 2014
 
 

5.2.2 64–Bit Absolute

The 64–bit absolute code model for add() might look like this:

add:
         sethi   %hh(sum),%o5
         sethi   %lm(sum),%o2
         or      %o5,%hm(sum),%o4
         sllx    %o4,32,%o3
         or      %o3,%o2,%o1
         ld      [%o1+%lo(sum)],%g5
         add     %g5,%o0,%g3
         retl 
         st      %g3,[%o1+%lo(sum)]

Here it takes 6 instruction to form address of sum. The operators act as follows:

%hh(sum)R_SPARC_HH22 relocation
%hm(sum)R_SPARC_HM10
%lm(sum)R_SPARC_LM22
%lo(sum)R_SPARC_LO10