This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Different sized data and code pointers
- From: Julian Brown <julian at codesourcery dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 3 Mar 2005 16:21:56 +0000 (UTC)
- Subject: Re: Different sized data and code pointers
- Organization: CodeSourcery, LLC
- References: <BE4A70F4.94D2%schlie@comcast.net> <4225E2BD.7030606@csr.com>
- Reply-to: julian at codesourcery dot com
On 2005-03-02, Thomas Gill <thomas.gill@csr.com> wrote:
> Paul Schlie wrote:
>
>> With the arguable exception of function pointers (which need not be literal
>> address) all pointers are presumed to point to data, not code; therefore
>> may be simplest to define pointers as being 16-bits, and call functions
>> indirectly through a lookup table constructed at link time from program
>> memory, assuming it's readable via some mechanism; as the call penalty
>> incurred would likely be insignificant relative to the potential complexity
>> of attempting to support 24-bit code pointers in the rare circumstances
>> they're typically used, on an otherwise native 16-bit machine.
>
> Thanks for the response.
>
> Suppose we don't have enough space to burn on a layer of indirection for
> every function pointer. Do I take it that there's really not a clean way
> to make GCC treat function pointers as 24 bit while still treating data
> pointers as 16 bits?
FWIW, a port I did used indirection for all function pointers, albeit
for a different reason, and I can report that it seems to work OK in
practice with a little linker magic. It wasn't really production-quality
code though, I admit.
Perhaps the indirection table can safely hold only those functions whose
address is taken? (Or maybe that was assumed anyway?)
Julian
--
Julian Brown
CodeSourcery, LLC