DJ Delorie wrote:
For some chips, like xstormy16 and m16c, function pointers are wider than other pointers.
Trying to fake two kinds of pointers when we only have one doesn't seem wise to me.
A possible solution is to use function descriptors. See FDESC_EXPR and ASM_OUTPUT_FDESC. So now when you take the address of a function, you get a normal size pointer to a function descriptor. The contents of a function descriptor are machine dependent, as determined by ASM_OUTPUT_FDESC, so you can easily put the entire address in there.
This has some advantages. You don't need any machine independent gcc changes to make it work, and you don't need any (well, fewer) questionable C casts to get the full function address.
This also has disadvantages. This is an ABI change. You will need different code for calling through function pointers, though this may simplify or eliminate your thunks. End users will have to know that function addresses are actually function descriptor addresses, and write and appropriate code. If you want function comparisons to still work, you may need new relocs and linker support to handle function descriptors, to ensure that there is only one per function.
-- Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com