[parisc-linux] warning: minor abi change

John David Anglin dave@hiauly1.hia.nrc.ca
Sat, 5 Jul 2003 19:53:34 -0400 (EDT)


> 1) Dave warned us last December about __canonicalize_funcptr_for_compare
>    and gcc-3.3. "make modules_install" fails with this symbol missing in:
> 
>    	drivers/ide/ide-disk.o (fixed in patch but won't be committed)
> 	drivers/scsi/aic79xx/aic79xx.o
> 	fs/smbfs/smbfs.o
> 	lib/zlib_deflate/zlib_deflate.o
> 
>    Having no clue how to properly fix this in either the toolchain
>    or where to find the man page for __canonicalize_funcptr_for_compare(),
>    I disabled the last three in my .config and hacked ide-disk.c
>    to use (void *) for comparisons.
>    Any volunteer to write some sample code for this?

Instead of adding (void *) to each comparison, you could add a kernel
version of __canonicalize_funcptr_for_compare:

__canonicalize_funcptr_for_compare:
	bv %r0(%r2)
	copy %r26,%r28

or for PA 2.0

__canonicalize_funcptr_for_compare:
        bve (%r2)
	copy %r26,%r28

I think there was a possible solution along these lines posted on the list
a few months ago (joel?).

This solution assumes that canonicalization is unnecessary in the kernel.
Probably, in most cases it is.  However, if you really need to canonicalize
a function pointer from user space, then you are going to have to figure
out how to call into the dynamic loader from the kernel.  This obviously
isn't very safe.  So, possibly this implies that function pointers passed
in syscalls should be canonicalized before the kernel is entered (i.e.,
glibc should do the canonicalization).

As far as kernel modules go, I don't know how function pointers are
handled.  If you pass a function pointer from one module to another,
does it need canonicalization?  If canonicalization is never necessary
in the kernel, possibly I could add a GCC option to disable canonicalization.

Sorry, about the lack of documentation.  To see what the function does,
it's currently necessary to look in the GCC gcc/config/pa directory.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)