bFLT relocation problems when running busybox/uclibc

Rick Garcia rick at liveoaklogic.com
Fri Oct 20 12:34:32 UTC 2006


David McCullough wrote:
> Jivin Rick Garcia lays it down ...
>> David McCullough wrote:
>>> Jivin Rick Garcia lays it down ...
>>>>    I'm attempting to run busybox compiled against uClibc in bFLT format 
>>>> - busybox starts up, the kernel does the relocation, but it appears to 
>>>> be incomplete.   During debug, I can observe it performing a few hundred 
>>>> relocations, but I can identify more than a few places where it's using 
>>>> an invalid non-relocated address, and these all seem to be internal 
>>>> uClibc symbols.  As far as I can tell, all the busybox symbols are 
>>>> correctly relocated.
>>>>    Are there any flags that need to be passed to the uClibc build to 
>>>> get it to work with flat binary format?  I'm using the -Wl,-elf2flt when 
>>>> building busybox, but I built uClibc without any extra flags - my 
>>>> understanding was that they wouldn't be necessary when building a 
>>>> library like uClibc - I can't even identify a point in the build where 
>>>> they might be used.  Anyone have any ideas what could be causing this?
>>> It depends on how you have built your uClibc I guess.  Compare the build
>>> lines for each and check for differing "-m..." options.
>>     The only -m.. option is -msep_data.
> 
> Then both the lib and the app need to be built with that option.

     Removing the msep_data altogether seems to have done the trick... 
I'm getting a good build off of busybox and it's giving me around 3k 
(0xd08) symbols relocating - it looks complete, and it's playing nice 
with the kernel.

> 
>>> What kernel/arch/compilers are you using ?
>>     It's an m68k clone - kernel is uClinux 2.4.(30?), and the compiler 
>> is 3.4.4
>>
>>> Also it's probably better to ask on the uClinux-dev list :-)
>>     Will do :)
>>
>>     One question - are you aware of any way to verify that elf2flt has 
>> relocated all the relevant symbols in an image?  I know there isn't 
>> exactly a plethora of utilities for examining the bFLT format right now, 
>> but I need to find a way to check this.
>>     Right now, the flthdr is telling me that there are 322 relocations 
> 
> I think elf2flt has a -v:
> 
> 	-Wl,-elf2flt=-v
> 
>> - the make output logs and some quick checks I slapped into the kernel 
>> agree, so I'll concede that that much is working.  But 322 relocations 
>> for a program like busybox?  Every example I've seen online has had 
>> something on the order of 3000 relocations.  I have a minimal config 
>> going, but still... that's not a lot of symbols.
> 
> msep-data reduces the number of relocations to just the data segment and
> the GOT.  Don't have one to compare at the moment though,

the way elf2flt works, it won't perform relocations on text sections if 
there's any pic or GOT action going on, even if some sections of the 
executable need it.  That's probably why it only comes up with 300 
symbols when the -msep-data is enabled.  Maybe if I ever start smoking 
crack I can try implementing that :)..

Thanks again for the help.
> 
> Cheers,
> Davidm
> 
> 
-Rick



More information about the uClibc mailing list