void f0(void);
void f1(void);
void f2(void);
void g() { f0(); f1(); f2(); }
g:
push {r4, lr}
mov r4, r9
bl f(PLT)
mov r9, r4
bl f(PLT)
mov r9, r4
pop {r4, lr}
b f(PLT)
If GCC implements -fno-plt, it can use the following code sequence:
g:
push {r4, lr}
mov r4, r9
// call f0
ldr r12, .L0
add r12, r12, r4
ldr r9, [r12, #4]
ldr pc, [r12]
// call f1
ldr r12, .L1
add r12, r12, r4
ldr r9, [r12, #4]
ldr pc, [r12]
// tail call f2
ldr r12, .L2
add r12, r12, r4
ldr r9, [r12, #4]
pop {r4, lr}
ldr pc, [r12]
.L0: .word f0(GOTOFFFUNCDESC)
.L1: .word f1(GOTOFFFUNCDESC)
.L2: .word f2(GOTOFFFUNCDESC)