On Sat, 21 Aug 1999, Philip Blundell wrote:

> >     Why can the linker not deal with function calls more then a 26 bit
> >address offset from teh PC? 
> 
> The B instruction only has a 24-bit displacement field.  That stores a number
> of words which gives you a 26-bit address offset.  To do jumps beyond that, 
> the linker would have to bounce the call through a PLT entry.  It probably 
> wouldn't be too hard to make this happen automatically for out of range 
> jumps if you wanted (though this should be controlled by a switch).  As a 
> matter of passing interest modutils already does something a bit like this 
> so that kernel modules can be quite distant from the main code body.
> 
> Another possibility would be to extend the compiler and/or assembler to let 
> you declare a particular function call as being "long" and have that generate 
> code that rather than a straightforward branch contained code a bit like this:
> 
>       mov     lr, pc
>       ldr     pc, =target

A C construct like this should also do the trick:

extern void func();
void (*target)() = func;

foo()
{
    target();
}



Nicolas Pitre, B. ing.
[EMAIL PROTECTED]


unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]

Reply via email to