Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R_PPC_REL24 relocation out of range

I am working on an embedded powerpc (e500v2) platform. I am cross compiling compiling with gcc 4.6.3 and eglibc 2.13. There is a swig library that is compiled and loaded on the target. When its loaded in python I am getting this error in a traceback:

ImportError: /opt/load/lib/libISSDcn.so: R_PPC_REL24 relocation at 0x0ddc99c0 for symbol `longjmp' out of range

I have struggles with this library before, I am migrating from python 2.5 on our target to 2.7. When I initially attempted to compile this library I was getting either relocation errors or operand out of range errors at compile time depending on which flags I used. I switched to gcc 4.6.3 and now it builds, but I am getting this error when its loaded.

I am trying to understand the error, but so far I am in the dark on exactly what it means and how to fix it. I get that a symbol can't be found for some reason, but I don't understand why, or how to fix it.

like image 227
Eric Seifert Avatar asked Oct 12 '12 15:10

Eric Seifert


1 Answers

The R_PPC_REL24 relocation is used for 24 bit relative offsets. Relocations of this type should not appear in dynamic relocation tables (these are meant for references inside a loadable object, not between them, as libraries can be loaded to addresses more than 16 MiB apart).

By default, the compiler generates these relocs whenever possible, as this is significantly smaller and faster code than using full 32 bit addresses, however for dynamic linking, full addresses need to be used for externally visible symbols and PIC/GOT entries generated.

Check that the -fPIC flag was used for building the library, and that the linker was also notified that it is building a shared object (typically, via -shared or -Bshared).

like image 71
Simon Richter Avatar answered Sep 28 '22 08:09

Simon Richter