[LiSA-Users] Cross compiling

Kerry Brown pn_dev at digis.net
Fri Jan 12 10:47:43 EET 2007


Allright...

I was passing -EB to the linker...and i was actually supposed to be 
passing -mbig-endian

So its up and working.. on an intel ixp arm platform..and the 
routerboard series systems..
Im going to backport the current pach to my 2.6.15 kernel due to the 
newer kernels not being stable..

Thanks for the help...


Kerry Brown wrote:
> It didnt work out of the box because when doing Make CC=arm-linux-gcc
>
> the linker would always fail because it would call ld rather then then 
> arm-linux-ld..or the full path....
>
> Im running it manually per your suggestion, we will see what happens...
>
> This however did compile just fine on a mips system for me. so ...weird
>
>
> Ionut Nicu wrote:
>   
>> On Thu, 2007-01-11 at 02:54 -0700, Kerry Brown wrote:
>>   
>>     
>>> I actually just had to play with the Make file to get it to compile For 
>>> Big endian Arm....
>>>
>>>
>>> Here is the error I get when i try to link swctl
>>>
>>> arm-linux-ld -EB -o swctl swctl.o ../lib/misc.o
>>> arm-linux-ld: warning: cannot find entry symbol _start; defaulting to 
>>> 00008074
>>> swctl.o(.text+0x1c): In function `parse_hw_addr':
>>> : undefined reference to `calloc'
>>>     
>>>       
>> Hi Kerry,
>>
>> I'm not sure what changes have you made to the Makefiles, however it
>> seems like you're not linking against libc (i.e. the linker doesn't get
>> called with the appropriate flags and libraries).
>> To form an executable out of swctl.o and misc.o, the linker needs to
>> resolve some symbols such as _start and calloc (obviously, these are
>> from libc and are not defined in our object files).
>> The correct way to make an executable out of these object files is to
>> call 'gcc -o swctl swctl.o ../lib/misc.o'. This way gcc knows how to
>> pass the correct arguments to the linker.
>> Try running 'gcc -v -o swctl swctl.o ../lib/misc.o' to get an insight on
>> the parameters that gcc passes to the linker. For instance, on my x86
>> machine the interesting output is:
>>
>> gcc -v -o swctl swctl.o ../lib/misc.o
>>
>>  /usr/libexec/gcc/i686-pc-linux-gnu/3.4.6/collect2 --eh-frame-hdr -m
>> elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o
>> swctl /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../crt1.o /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../crti.o /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/crtbegin.o -L/usr/lib/gcc/i686-pc-linux-gnu/3.4.6 -L/usr/lib/gcc/i686-pc-linux-gnu/3.4.6 -L/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/lib -L/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../.. swctl.o ../lib/misc.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/crtend.o /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../crtn.o
>>
>> You can see here that swctl is linked also from ld-linux.so.2 crti.o and
>> crtn.o.
>>
>> I'm not sure why 'make' didn't work right out of the box for you (the
>> rule that makes swctl is correct: $(CC) $(LDFLAGS) -o swctl
>> $^ ../lib/misc.o). Here $(CC) must be resolved to your cross compiler
>> (arm gcc). If that's the problem, try setting CC to your cross compiler
>> and make should work just fine.
>>
>> Ionut.
>>
>> _______________________________________________
>> LiSA-Users mailing list
>> LiSA-Users at lisa.ines.ro
>> http://lisa.ines.ro/mailman/listinfo/lisa-users
>>   
>>     
>
> _______________________________________________
> LiSA-Users mailing list
> LiSA-Users at lisa.ines.ro
> http://lisa.ines.ro/mailman/listinfo/lisa-users
>   



More information about the LiSA-Users mailing list