[uClinux-dev] BINFMT_RELOC error when linking to pthreads

Paul_Dale at au.securecomputing.com Paul_Dale at au.securecomputing.com
Tue Feb 5 16:50:33 EST 2008


Sean wrote:

> So which is it? A link script issue or a loader issue? I am hoping this 
> is just a matter of getting my compiler flags setup correctly and 
> matching the options used to build the libraries. Building for a flat 
> memory model seems a bit tricky.

The bug is in the loader - kind of.  When it does a relocation, it checks that 
the final result lies inside either the code or data segment and if it doesn't 
this message is issued.

It is possible to write perfectly good code for which the compiler/optimiser 
generates relocations that are outside the program.  Your case is a new one to 
me and I've not investigated why the problem is appearing here.

As for the fix: there isn't one.  The elf to flat conversion throws out the 
base segment for the relocations so there is no way to know if the relocation 
should be against the data or code segment.

As for workarounds, try to identify the relocation that is causing the problem 
and then code around it.  Failing that, try different compiler optimisation 
levels '-O1', '-O2', '-Os', '-O3', '-O0' in that order.  Then shuffle your 
segments around (which might stop the message but not fix the underlying 
problem).


Regards,

Pauli
-- 
Dr Paul Dale
Software Grunt

Secure Computing(r) 
your trusted source for enterprise security(tm)
www.securecomputing.com <http://www.securecomputing.com/> 




More information about the uClinux-dev mailing list