>> Couldn't this be compiled to as the following, with using r12 'ip': >> >> 00000000 <test>: >> 0: xxxxxxxx push {r4, lr} >> 4: xxxxxxxx mov r4, r0 >> 8: xxxxxxxx ldr ip, [r0] >> c: xxxxxxxx bl 0 <func> >> 10: xxxxxxxx str ip, [r4] >> 14: xxxxxxxx pop {r4, pc} >> > >No. IP cna be clobbered either by func itself or any >inter-procedural >veneer that might be generated by the linker. You'd need to prove >that >neither could happen before IP could be used to hold a value over a >function call. > >R.
Ah, yes of course you are right, my mistake. Meaning also that r1-r3 which be used as unsused arguments/scratch in this case cannot be used either, since inner function calls are not obliged to restore them according to AAPCS. I think I got confused by the dummy register pushes added to keep stack alignment. Thanks! BR Fredrik