Hi Dmitry,

Thanks for taking an interest in my problems.

On Monday 17 January 2005 23:27, mspgcc-users-requ...@lists.sourceforge.net 
wrote:
> From: "Dmitry" <d...@radio.rphf.spbstu.ru>
> Date: Mon, 17 Jan 2005 11:49:21 +0300
> To: <mspgcc-users@lists.sourceforge.net>
> Subject: Re: [Mspgcc-users] Position-independent function call
> Reply-To: mspgcc-users@lists.sourceforge.net
> 
> wait wait wait....
> mspgcc generates position independent code within a function.

Right, that's what started me on this code-moving adventure. Provided there 
are no calls, it is all perfectly position-independent.

> Only if you want to copy to ram more than two functions, you will need
> pc-relative calls and such.
> I am planning add this feature to gcc-4

Great news. Then all the code will be position-independent, except for calls 
outside the PC offset range. This will be ideal, and a bit smaller and 
faster for almost every call, too.

> but now you can do the following: 
> 1. Rearrange you code the way that only one function has to be copied to
> ram.

That's exactly what I've done, and it works well. It could be made to work 
better with function calls. I end up repeating some blocks of code, and RAM 
is rarely plentiful on these machines.

> Or
> 2. every function call program via inline assembler: asm volatile ("call
> funct");

I have tried, but I can't seem to make it work. How do I persuade the asm to 
build a PC-relative call? I'm probably missing something really simple, 
here.

-- 
Rick Jenkins <r...@hartmantech.com>
Hartman Technica           http://www.hartmantech.com 
Phone +1 (403) 230-1987 voice & fax
221 35 Avenue. N.E., Calgary, Alberta, Canada T2E 2K5

Reply via email to