This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: crosstool - More Output and Experments


Hi Dan,

I am giving you more output with experments. So
visualize where is the error. 

source file: hello.c
#include <stdio.h>
int main(int argc, char **argv){

     printf("Hello, World");

     return 0;
}
#arm-linux-gcc -o hello.shared hello.c
Now on target board:

#ldconfig -v 
bin # ldconfig -v
ldconfig: Can't stat /usr/lib: No such file or
directory
ldconfig: Path `/lib' given more than once
/lib:
        ld-linux.so.2 -> ld-2.2.5.so
        libutil.so.1 -> libutil-2.2.5.so
        libresolv.so.2 -> libresolv-2.2.5.so
        libpthread.so.0 -> libpthread-0.9.so
        libm.so.6 -> libm-2.2.5.so
        libdl.so.2 -> libdl-2.2.5.so
        libcrypt.so.1 -> libcrypt-2.2.5.so
        libc.so.6 -> libc-2.2.5.so
/qt/lib:
        libqte.so.3 -> libqte.so.3.2.3

then ld.so.cache is genereated in /etc/ dir. 
I need write echo libc.so.6 > /etc/ld.so.preload
otherwise strace output quits giving error that
ld.so.preload doesn't exits ...even without trying
ld.so.cache? why?

Here is the output:
/test # strace ./hello.shared
execve("./hello.shared", ["./hello.shared"], [/* 5
vars */]) = 0
uname({sys="Linux", node="(none)", ...}) = 0
brk(0)                                  = 0x10550
open("/etc/ld.so.preload", O_RDONLY)    = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=10, ...}) =
0
old_mmap(NULL, 10, PROT_READ|PROT_WRITE, MAP_PRIVATE,
3, 0) = 0x40013000
close(3)                                = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=802, ...}) =
0
old_mmap(NULL, 802, PROT_READ, MAP_PRIVATE, 3, 0) =
0x40014000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3,
"\177ELF\1\1\1a\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0008\241\1"...,
1024) = 102
4
fstat64(3, {st_mode=S_IFREG|0755, st_size=1254738,
...}) = 0
old_mmap(NULL, 1103544, PROT_READ|PROT_EXEC,
MAP_PRIVATE, 3, 0) = 0x4001c000
mprotect(0x40119000, 67256, PROT_NONE)  = 0
old_mmap(0x4011c000, 40960, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0xf8
000) = 0x4011c000
old_mmap(0x40126000, 14008, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANON
YMOUS, -1, 0) = 0x40126000
close(3)                                = 0
munmap(0x40013000, 10)                  = 0
--- SIGILL (Illegal instruction) @ 0 (0) ---
+++ killed by SIGILL +++

But it still exits with illigal instruction...why?

Regards,
Trilok Soni







 --- Trilok Soni <trilok_ulug@yahoo.co.in> wrote: >
Hi,
> 
> > OK, let's see where libc.so is, and what's in it.
> > On the target board, what do the commands
> > # ls -l /lib/libc[-.]*
> 
> libc-2.2.5.so
> libc.so.6->libc-2.2.5.so
> 
> > # cat /lib/libc.so
> /* GNU ld script
>    Use the shared library, but some functions are
> only
> in
>    the static library, so try that secondarily.  */
> GROUP ( libc.so.6 libc_nonshared.a )
> / #
> 
> 
> > # ldd ./hello
> ldd is not availbale on target. But I can give
> readelf
> output:
> 
> #arm-linux-readelf -a hello | grep "Shared"
> 0x00000001 (NEEDED)  Shared Library: [ libc.so.6 ]
> 
> #arm-linux-readelf -a hello | grep "ld-linux.so.2"
> [Requesting program interpreter :
> /lib/ld-linux.so.2]
> 
> > say?  Also, if you compile strace statically, what
> > does
> > # strace ./hello
> > say?  (You can get strace from
> 
> test # strace ./hello.shared
> execve("./hello.shared", ["./hello.shared"], [/* 5
> vars */]) = 0
> uname({sys="Linux", node="(none)", ...}) = 0
> brk(0)                                  = 0x1060c
> open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT
> (No such file or directory)
> --- SIGILL (Illegal instruction) @ 0 (0) ---
> +++ killed by SIGIL
> 
> ---
> Why it is opening ld.so.preload - I think related
> with
> security concern..Do I have make one...?
> I don't have ld.so.preload on my target. But I don't
> understand it's requirement.
> 
> Just write back if u need more information. I need
> to
> solve this problem. Because my C++ library problem
> is
> hanging and depends upon the solution of above
> problem.
> 
> 
> Regards
> Trilok Soni
>  --- Dan Kegel <dank@kegel.com> wrote: > Trilok Soni
> wrote:
> > > I have built arm-linux toolchain using
> > crosstool-0.25
> > > version from kegel.com.
> > > 
> > > script executed for:
> > > arm.dat gcc-3.2.3-glibc-2.2.5 
> > > 
> > > Board:
> > > NMS9200 - MiMagic5
> > > 
> > > I have then built ramdisk for my target board
> > nms9200.
> > > I have copied following files on 
> > > ramdisk/lib.
> > > 
> > > # ls  $ARM_ROOT/ramdisk/lib
> > > ld-2.2.5.so			libgcc_s.so	libstdc++.so ...
> > > 
> > > Now when I execute simple Hello, World "c"
> shared
> > > library program, it just comeback to shell 
> > > without printing a "hello, world" message.
> >  > ...
> >  > I think it is able to find loader..but loader
> is
> >  > unable to load libc.so to memory. Do u think
> that
> >  > I have to copy library somewhere else?
> > 
> 
> 
>
________________________________________________________________________
> Yahoo! India Mobile: Download the latest polyphonic
> ringtones.
> Go to http://in.mobile.yahoo.com
> 
> ------
> Want more information?  See the CrossGCC FAQ,
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sources.redhat.com
>  

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones.
Go to http://in.mobile.yahoo.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]