Colin Whittaker wrote: > Colin Whittaker wrote: >> André Goddard Rosa wrote: >>> On Thu, Feb 26, 2009 at 4:45 PM, Colin Whittaker >>> <[email protected] <mailto:[email protected]>> wrote: >>> >>> Hi, I'm new here. I searched and found a similar thread that >>> didn't seem to get resolved. Any help would be grand.. :-) >>> >>> I'm trying to build a cross tool chain for mips using buildroot. >>> uClibc 0.9.29 >>> gcc 4.2.3 >>> binutils 2.18 >>> Kernel headers 2.6.21.5 >>> >>> Everything builds fine and my target system builds just fine. >>> Kernel builds and runs just fine. Only problem: >>> All the executables that load shared libraries segfault immediately. >>> This was most difficult to find since init(busybox) was >>> segfaulting, but it shows nothing. Once I built it with -static >>> it runs. >>> >>> >>> Hi! >>> >>> Are you compiling it with both -rdynamic and -fPIC? Which >>> compiler flags do you use? Can you provide an example code? >>> >>> >>> -- >>> []s, >>> André Goddard >> No. I'm using no flags in this example: >> # cat test.c >> #include <unistd.h> >> >> int main( int argc, char **argv ) >> { >> while(1) { >> write( 0, "Hello world!\n", 13 ); >> } >> } >> # >> # mips-linux-gcc -o test test.c >> # >> >> On the target, I just get >> # ./test >> Segmentation fault >> # >> >> mips-linux-objdump shows that NULL Program Header in this application >> too. >> I will try to get gdb to build with -static and see if I can trace >> where it is crashing. >> >> BTW, tried the other binutils, 2.18.50.0.1 with the same results. >> >> GDB seems unable to debug this as well. >> I built gdb with static libraries and tried to debug test.c >> I gets the Segmentation fault, and dumps out of gdb....weird I thought >> gdb was suppose to catch these things.. >> # gdb test >> GNU gdb 6.8 >> Copyright (C) 2008 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later >> <http://gnu.org/licenses/gpl.html> >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" >> and "show warranty" for details. >> This GDB was configured as "mips-linux"... >> (gdb) l >> warning: Source file is more recent than executable. >> 1 #include <unistd.h> >> 2 >> 3 int main( int argc, char **argv ) >> 4 { >> 5 while(1) { >> 6 write( 0, "Hello world!\n", 13 ); >> 7 } >> 8 } >> (gdb) b 3 >> Breakpoint 1 at 0x4005e0: file test.c, line 3. >> (gdb) run >> Starting program: /test >> Segmentation fault >> # >> >> Colin.. >> > Tried strace, (built with static libs) > # ./strace ./test > execve("./test", ["./test"], [/* 9 vars */]) = 0 > --- SIGSEGV (Segmentation fault) @ 0 (0) --- > +++ killed by SIGSEGV +++ > # > > Colin.. > Try enabling debug early support into dynamic linker and run again. Just to see if it is failing in the dynamic linker or in the application. I suggest to build uclibc with full debug symbols too and start a real debuggging session with gdb. I'd suggest to set bp in __uClibc_main (unless you are failing before entering in this function), and then go step by step.
I successfully debugged the ld.so in the past, so it is not impossible. Carmelo > > ------------------------------------------------------------------------ > > _______________________________________________ > uClibc mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/uclibc _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
