We have a problem with arguments passing in memory. The caller puts the arguments in memory relative to the sp: add sp, 4 // allocate space for the argument. stack grows up store r1, (sp-4) // store the argument on the stack call xxx // call the function.
In xxx the result code looks like: load (sp-4), r1 // load the argument from the stack. The problem is that the 'call' instruction pushes the return address to the stack and increments the sp by 4 so when the callee tries to access the memory it does not get to the correct location. How can I tell GCC that that the callee should load from the original offset + 4? Thanks.