This is the mail archive of the crossgcc@sourceware.org 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: crt1.o not found in mipsel-linux


pati (sent by Nabble.com) wrote:

can you explain me why this object file is used for.....

The 'crt1.o' is the 'shell' around the 'main()' function, the program entry symbol, '_start' (usually), is in it. It does some initializing before calling 'main()' and when 'main()' exits, it does some 'atexit()' etc. tasks before going to 'exit()'...

All the previous should be told on a "primary course in C"...

Also when I use gcc linker ld with the following linker options ,

mipsel-linux-ld -o main.elf main.o -L /usr/lib -lc -I /lib

Using the linker directly is very rare. The GCC used should know where to search the standard C libraries. So the 'gcc' driver will be used also in linking, like :

mipsel-linux-gcc -o main.elf main.o

The '-L /usr/lib -lc -I /lib' has no sanity !  The stuff in these
places has the native libraries, not the Linux/MIPS libraries!

this is what I get...

mipsel-linux-ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
mipsel-linux-ld: cannot find /lib/libc.so.6

Of course the native stuff is incompatible with the Linux/MIPS tools!

what is this libc.so.6 ???. From what I figure out, the linker
> is looking for libc.so in /lib instead of /usr/lib.

The 'libc.so.6' is the name for the 'real' shared C library, 'libc
version 6', in current Linuces. The earlier was 'libc version 5',
and its shared library name was 'libc.so.5'. Distros like Red Hat 4,
SuSE 5 etc. still used the 'libc5'.

The '/usr/lib/libc.so' is only a 'linker script' which tells which
real libraries should be linked against when the linker tries to
link against the 'libc.so'. Currently a native glibc has the row:

GROUP( /lib/libc.so.6 /usr/lib/libc_nonshared.a )

in it telling what to link against. In a cross GCC this file is
usually edited to have only the base library names :

GROUP( libc.so.6 libc_nonshared.a )

The linker takes care about finding them from their right places.

Please try the '-v' and '-Wl,-verbose' ("give '-verbose' to the linker)
commands on your 'mipsel-linux-gcc' command line in order to learn
something about what happens during "compiling and linking" !  Like:

  mipsel-linux-gcc -v -Wl,-verbose -O2 \
  -o hi_mips-linux.x hello.c > Logfile 2>&1

The '> Logfile 2>&1' should cause the output text going into a logfile
instead of the screen...

------
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]