linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Unhandled relocation of type 11
@ 2005-04-06 21:18 Joshua Lamorie
  2005-04-07  9:19 ` Wolfgang Grandegger
  0 siblings, 1 reply; 4+ messages in thread
From: Joshua Lamorie @ 2005-04-06 21:18 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: rtai

Please excuse this cross-post, but I think it is of interest to both 
RTAI and Linux PPC folks.

I am making a kernel module (an RTAI task) that needs floating point 
support so I'm using IBMs perflib floating-point libraries (on a 
Virtex-II Pro, aka ppc405).

This is actually built from Matlab/simulink real-time workshop output (I 
can't use rtai-lab because I don't think lxrt is available for ppc)... 
so there end up being many object files to link.

So, in the end I have a linker command as follows.

powerpc-405-linux-gnu-ld -r -m elf32ppclinux -L/some/directories
matlab_root/rtw/c/libsrc/rt_zcfcn.o other.o inputs.o -o module_output.o
perflibs/fpopt/libppcfp.a

Then I go to insert the module and....
/var/shm # insmod test001_build_rtmodule.o
Warning: loading test001_build_rtmodule.o will taint the kernel: non-GPL 
license - Proprietary
  See http://www.tux.org/lkml/#export-tainted for information about 
tainted modules
test001_build_rtmodule.o: Unhandled relocation of type 11 for __fixdfsi
test001_build_rtmodule.o: Unhandled relocation of type 11 for __fixdfsi

Hrmm... so any ideas on what type 11 is?  I can see from the code in 
modutils that this value is inside rel->r_info, such as R_PPC_ADDR32 or 
R_PPC_ADDR16_HA.

But where do I get more info about where r_info gets assigned?  Do I 
need to link libppcfp.a in a particular way?

Any hints would be appreciated.

Thanks in advance.

Joshua

-- 

Xiphos Technologies
(514) 848-9640 x227
(514) 848-9644 fax

www.xiplink.com
_______________________________________________
The information transmitted is intended only for the
person or entity to which it is addressed and may contain
confidential and/or privileged material.  If you have
received this in error, please contact the sender and delete
this communication and any copy immediately. Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unhandled relocation of type 11
  2005-04-06 21:18 Unhandled relocation of type 11 Joshua Lamorie
@ 2005-04-07  9:19 ` Wolfgang Grandegger
  2005-04-07 14:20   ` Joshua Lamorie
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Grandegger @ 2005-04-07  9:19 UTC (permalink / raw)
  To: Joshua Lamorie; +Cc: rtai, linuxppc-embedded

Hello,

I'm not a linker expert but some time ago I got the gcc soft floating
library working for 8xx and 4xx in kernel space. The problem was with
PIC. Maybe your library is built with PIC and it's required without. You
may want to have a look to:

  ftp://ftp.denx.de/pub/RTAI/contrib/fp_ppc_8xx.tar.bz2

Wolfgang.


On 04/06/2005 11:18 PM Joshua Lamorie wrote:
> Please excuse this cross-post, but I think it is of interest to both 
> RTAI and Linux PPC folks.
> 
> I am making a kernel module (an RTAI task) that needs floating point 
> support so I'm using IBMs perflib floating-point libraries (on a 
> Virtex-II Pro, aka ppc405).
> 
> This is actually built from Matlab/simulink real-time workshop output (I 
> can't use rtai-lab because I don't think lxrt is available for ppc)... 
> so there end up being many object files to link.
> 
> So, in the end I have a linker command as follows.
> 
> powerpc-405-linux-gnu-ld -r -m elf32ppclinux -L/some/directories
> matlab_root/rtw/c/libsrc/rt_zcfcn.o other.o inputs.o -o module_output.o
> perflibs/fpopt/libppcfp.a
> 
> Then I go to insert the module and....
> /var/shm # insmod test001_build_rtmodule.o
> Warning: loading test001_build_rtmodule.o will taint the kernel: non-GPL 
> license - Proprietary
>   See http://www.tux.org/lkml/#export-tainted for information about 
> tainted modules
> test001_build_rtmodule.o: Unhandled relocation of type 11 for __fixdfsi
> test001_build_rtmodule.o: Unhandled relocation of type 11 for __fixdfsi
> 
> Hrmm... so any ideas on what type 11 is?  I can see from the code in 
> modutils that this value is inside rel->r_info, such as R_PPC_ADDR32 or 
> R_PPC_ADDR16_HA.
> 
> But where do I get more info about where r_info gets assigned?  Do I 
> need to link libppcfp.a in a particular way?
> 
> Any hints would be appreciated.
> 
> Thanks in advance.
> 
> Joshua
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unhandled relocation of type 11
  2005-04-07  9:19 ` Wolfgang Grandegger
@ 2005-04-07 14:20   ` Joshua Lamorie
  2005-04-08 14:08     ` Joshua Lamorie
  0 siblings, 1 reply; 4+ messages in thread
From: Joshua Lamorie @ 2005-04-07 14:20 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: rtai, linuxppc-embedded

Gidday there,

Thanks for the hint.  However I can't see any reference to -fPIC in the 
makefiles for ppcperflib.  One thing I have discovered though is that 
type 11 is defined in /usr/include/elf.h as R_PPC_ELF14.  This error 
happens twice, for __fixdfsi, and when I look for references to 
__fixdfsi, I find that there are two calls to...

    blt __fixdfsi

inside ppc_dtoui.S.  Looking at the PPC Ref Guide, I see that blt is a 
mnemonic for bc (branch conditional) and uses a relative offset of 14 
bits.  In the same function there is also a use of 'bl' (branch, long I 
think) calling the same __fixdfsi.  So I'm going to add a stupid line of 
assembly to conditionally jump over the branch to __fixdfsi... I hope 
that will work, but I haven't touched assembly since an 80286.

Joshua

Wolfgang Grandegger wrote:

>Hello,
>
>I'm not a linker expert but some time ago I got the gcc soft floating
>library working for 8xx and 4xx in kernel space. The problem was with
>PIC. Maybe your library is built with PIC and it's required without. You
>may want to have a look to:
>
>  ftp://ftp.denx.de/pub/RTAI/contrib/fp_ppc_8xx.tar.bz2
>
>Wolfgang.
>
>
>On 04/06/2005 11:18 PM Joshua Lamorie wrote:
>  
>
>>Please excuse this cross-post, but I think it is of interest to both 
>>RTAI and Linux PPC folks.
>>
>>I am making a kernel module (an RTAI task) that needs floating point 
>>support so I'm using IBMs perflib floating-point libraries (on a 
>>Virtex-II Pro, aka ppc405).
>>
>>This is actually built from Matlab/simulink real-time workshop output (I 
>>can't use rtai-lab because I don't think lxrt is available for ppc)... 
>>so there end up being many object files to link.
>>
>>So, in the end I have a linker command as follows.
>>
>>powerpc-405-linux-gnu-ld -r -m elf32ppclinux -L/some/directories
>>matlab_root/rtw/c/libsrc/rt_zcfcn.o other.o inputs.o -o module_output.o
>>perflibs/fpopt/libppcfp.a
>>
>>Then I go to insert the module and....
>>/var/shm # insmod test001_build_rtmodule.o
>>Warning: loading test001_build_rtmodule.o will taint the kernel: non-GPL 
>>license - Proprietary
>>  See http://www.tux.org/lkml/#export-tainted for information about 
>>tainted modules
>>test001_build_rtmodule.o: Unhandled relocation of type 11 for __fixdfsi
>>test001_build_rtmodule.o: Unhandled relocation of type 11 for __fixdfsi
>>
>>Hrmm... so any ideas on what type 11 is?  I can see from the code in 
>>modutils that this value is inside rel->r_info, such as R_PPC_ADDR32 or 
>>R_PPC_ADDR16_HA.
>>
>>But where do I get more info about where r_info gets assigned?  Do I 
>>need to link libppcfp.a in a particular way?
>>
>>Any hints would be appreciated.
>>
>>Thanks in advance.
>>
>>Joshua
>>
>>    
>>

-- 

Xiphos Technologies
(514) 848-9640 x227
(514) 848-9644 fax

www.xiplink.com
_______________________________________________
The information transmitted is intended only for the
person or entity to which it is addressed and may contain
confidential and/or privileged material.  If you have
received this in error, please contact the sender and delete
this communication and any copy immediately. Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unhandled relocation of type 11
  2005-04-07 14:20   ` Joshua Lamorie
@ 2005-04-08 14:08     ` Joshua Lamorie
  0 siblings, 0 replies; 4+ messages in thread
From: Joshua Lamorie @ 2005-04-08 14:08 UTC (permalink / raw)
  To: Joshua Lamorie; +Cc: Wolfgang Grandegger, rtai, linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

Yes, this fix appeared to work.  It looks like there are just four 
14-bit references:

ppc_ftoui.S:56:     blt     __fixsfsi               /* return directly 
from there */     
ppc_ftoui.S:61:     blt     __fixsfsi               /* return directly 
form there */
ppc_dtoui.S:63:     blt     __fixdfsi
ppc_dtoui.S:73:     blt     __fixdfsi

I've sent an email to the sourceforge maintainer, but I haven't heard 
anything yet.  It's a great library, it greatly improves FP 
performance.  Anyone else been using it?  Any problems?

My fix is attached.

Joshua

-- 

Xiphos Technologies
(514) 848-9640 x227
(514) 848-9644 fax

www.xiplink.com
_______________________________________________
The information transmitted is intended only for the
person or entity to which it is addressed and may contain
confidential and/or privileged material.  If you have
received this in error, please contact the sender and delete
this communication and any copy immediately. Thank you.


[-- Attachment #2: fptoui_module.patch --]
[-- Type: text/plain, Size: 2514 bytes --]

--- perflibs.orig/fpopt/ppc_dtoui.S	2003-12-12 15:38:02.000000000 -0500
+++ perflibs/fpopt/ppc_dtoui.S	2005-04-08 10:03:19.629210784 -0400
@@ -53,14 +53,26 @@ function_prolog(__fixunsdfsi)
 
 /* For negative numbers, just convert to signed integer */
      or.     r3,r3,r3      
-     blt     __fixdfsi               /* return directly from there */      
+#if defined(__KERNEL__) && defined(MODULE)
+     bge     positive
+     bl     __fixdfsi               /* return directly from there */      
+#else
+     blt     __fixdfsi
+#endif
      
+positive:	     
      rlwinm  r8,r3,12,0x000007FF      /* extract exponent */
 /* For numbers less than maximum positive signed integer, convert normally */     
      cmpwi   r8, 0x041e     
-     blt     __fixdfsi               /* return directly form there */
+#if defined(__KERNEL__) && defined(MODULE)
+     bge     overmax 
+     bl     __fixdfsi               /* return directly form there */
+#else
+     blt     __fixdfsi
+#endif
      
 /* Create stack frame, just to save link register! */
+overmax:
      mflr    r0                      /* save link register in caller's stack */
      stw     r0,4(r1)               
      stwu    r1,-STACKSIZE(r1)       /* set up stack frame to hold saved regs */
--- perflibs.orig/fpopt/ppc_ftoui.S	2003-12-12 15:38:02.000000000 -0500
+++ perflibs/fpopt/ppc_ftoui.S	2005-04-08 10:06:46.155813968 -0400
@@ -53,14 +53,26 @@ function_prolog(__fixunssfsi)
 
 /* For negative numbers, just convert to signed integer */
      or.     r3,r3,r3      
-     blt     __fixsfsi               /* return directly from there */      
+#if defined(__KERNEL__) && defined(MODULE)
+     bge     positive
+     bl      __fixsfsi               /* return directly from there */      
+#else
+     blt     __fixsfsi
+#endif	
      
+positive:
      rlwinm  r8,r3,9,0x000000FF      /* extract exponent */
 /* For numbers less than maximum positive signed integer, convert normally */     
      cmpwi   r8, 0x009e     
-     blt     __fixsfsi               /* return directly form there */
+#if defined(__KERNEL__) && defined(MODULE)
+     bge     overmax 
+     bl      __fixsfsi               /* return directly form there */
+#else
+     blt     __fixsfsi
+#endif
      
 /* Create stack frame, just to save link register! */
+overmax:
      mflr    r0                      /* save link register in caller's stack */
      stw     r0,4(r1)               
      stwu    r1,-STACKSIZE(r1)       /* set up stack frame to hold saved regs */

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-04-08 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-06 21:18 Unhandled relocation of type 11 Joshua Lamorie
2005-04-07  9:19 ` Wolfgang Grandegger
2005-04-07 14:20   ` Joshua Lamorie
2005-04-08 14:08     ` Joshua Lamorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).