1 # Declare a function called NAME and an __fn_NAME stub for it.
2 # Make the stub use la_TYPE to load the the target address into $2.
5 .section .mips16.fn.\name, "ax", @progbits
24 # Like stub, but ensure NAME is a local symbol.
25 .macro lstub,name,type
30 # Like stub, but ensure NAME is a hidden symbol.
31 .macro hstub,name,type
37 # Like lstub, but make the MIPS16 function global rather than local.
38 .macro gstub,name,type
43 # Use an absolute sequence to load NAME into a register.
44 .macro la_noshared,name
46 addiu $2,$2,%lo(\name)
49 # Use the normal PIC sequence to load __fn_local_NAME into $2
50 # and emit a dummy relocation against NAME. This macro is always
51 # used at the start of a function.
53 .reloc 0,R_MIPS_NONE,\name
55 la $2,__fn_local_\name
58 # Use TYPE (either LSTUB, HSTUB or GSTUB) to define functions
59 # called a_NAME and b_NAME. The former uses absolute accesses
60 # and the latter uses PIC accesses.
62 \type a_\name, noshared
66 # Emit the MIPS16 PIC sequence for setting $28 from $25.
67 # Make the value of $25 available in $2 as well.
70 addiu $3,$pc,%lo(_gp_disp)
76 # Likewise, but for non-MIPS16 code.
77 .macro cpload_nomips16
82 # Start a PIC function in ISA mode MODE, which is either "mips16"
84 .macro pic_prologue,mode
91 # Use a PIC function to call NAME.
92 .macro pic_call,name,mode
95 lw $2,%got(__fn_local_\name)($2)
96 addiu $2,%lo(__fn_local_\name)
102 lw $2,%call16(\name)($2)
110 # Finish a PIC function started by pic_prologue.
117 # Use PIC %call16 sequences to call a_NAME and b_NAME.
118 # MODE selects the ISA mode of the code: either "mips16"
120 .macro callpic,name,mode
123 .ent callpic_\name\()_\mode
124 callpic_\name\()_\mode:
126 pic_call a_\name,\mode
127 pic_call b_\name,\mode
129 .end callpic_\name\()_\mode
132 # Use absolute jals to call a_NAME and b_NAME. MODE selects the
133 # ISA mode of the code: either "mips16" or "nomips16".
134 .macro jals,name,mode
137 .ent jals_\name\()_\mode
146 .end jals_\name\()_\mode