This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: is casting of function descriptor assignments for ia64 ONLY a good idea?
- From: Grant Grundler <grundler at dsl2 dot external dot hp dot com>
- To: Piet/Pete Delaney <piet at sgi dot com>
- Cc: Keith Owens <kaos at ocs dot com dot au>, linux-ia64 at linuxia64 dot org,srn at engr dot sgi dot com, davidm at hpl dot hp dot com, bug-gdb at gnu dot org, bug-gcc at gnu dot org
- Date: Thu, 03 Jan 2002 10:35:51 -0700
- Subject: Re: is casting of function descriptor assignments for ia64 ONLY a good idea?
- References: <20020102162714.A1790@sgi.com> <14034.1010028604@kao2.melbourne.sgi.com> <20020102214635.A2607@sgi.com>
Piet/Pete Delaney wrote:
> SUMMARY:
>
> Keith Owens just pointed out that ia64 function descriptor assignments
> MUST be cast:
>
> pointer = ((unsigned long *)(&my_printf))[0])
>
> howerver it appears that other platforms MUST NOT be cast.
I'm pretty sure parisc64 (ELF) does something similar.
We had issues with 32<->64 bit syscall wrappers where a 32-bit user space
structure passed to the kernel contained a function pointer. I thought it
was in either ioctl32.c or sys_wrapper32.c:
http://cvs.parisc-linux.org/linux/arch/parisc/kernel/
but couldn't find the exact code.
IIRC, a function ptr has 4 elements and the 3rd contains the addr
to the actual code.
> I've used pointers to functions a lot in the past and I don't recall
> ever haveing a problem like this.
IIRC, the compiler/linker deal with this transperently.
It's only done with function pointers (and not other pointer types).
I only remember seeing this as an issue in 32-64 syscall wrapper conversion.
grant