public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* compile error
@ 2000-06-28 23:48 timntsai
  2000-06-29  2:37 ` Kai Ruottu
  0 siblings, 1 reply; 2+ messages in thread
From: timntsai @ 2000-06-28 23:48 UTC (permalink / raw)
  To: crossgcc; +Cc: tsaicm

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Hi:
    I build a necvr4300-elf cross compiler for mips.
    and try to compile a simple c program then get following error:
 
..../mipsvr4300-elf/bin/ld: cannot open crt0.o
    No such file or directory
  collect2:ld return 1 exit status.
 
How can I resolve this problem. 
And whait is a crt0.o,why it's needed.
 
BR.
 

_________________________________________________________
 pchome §K¶O¹q¤l«H½c¡A¥Ó½Ð½Ð¦Ü: http://www.pchome.com.tw 

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: compile error
  2000-06-28 23:48 compile error timntsai
@ 2000-06-29  2:37 ` Kai Ruottu
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Ruottu @ 2000-06-29  2:37 UTC (permalink / raw)
  To: timntsai; +Cc: crossgcc, tsaicm

timntsai@pchome.com.tw wrote:
 
>     I build a necvr4300-elf cross compiler for mips.
>     and try to compile a simple c program then get following error:
> 
> ..../mipsvr4300-elf/bin/ld: cannot open crt0.o
>     No such file or directory
>   collect2:ld return 1 exit status.

 You are trying to compile AND link your program, not just 'compile'
(into a '.s' assembly file using '-S', or into a '.o' object file
using '-c'). For linking you will need a startup-file (crt0.o) and
the C-libraries (libc.a, libm.a,...) in order to get a working
executable.

 BTW, how you managed to build 'libgcc.a' without any target headers?
If you haven't the startup and libs, then you probably haven't any
headers either...
 
> How can I resolve this problem.

 Please get a C-library for your target, e.g. building the Cygnus
'newlib' for your target, or getting some prebuilt libs like those
from the Algorithmics SDE (www.algor.co.uk, they have startup/glue
libs support packages for quite many evaluation etc. boards).

> And whait is a crt0.o,why it's needed.

 Please also get some docs, like the Algorithmics SDE manual, Cygnus
GNUPro docs etc. for these things. Anyhow here is a clip from the
'embed'-one coming with newlib (misc/doc/embed.texi, or something) :

--------------------------- clip -----------------------------------------
The main startup file, crt0

To make a program that has been compiled with GCC to run, you need to
write some startup code. The initial piece of startup code is called
crt0. (C RunTime 0) This is usually written in assembler, and it's
object gets linked in first, and bootstraps the rest of the application
when executed. This file needs to do the following things.

1. Initialize anything that needs it. This init section varies. If you
are developing an application that gets download to a ROM monitor, then
there is usually no need for any special initialization. The ROM monitor
handles it for you.

If you plan to burn your code in a ROM, then the crt0 typically has to do
all the hardware initialization that is required to run an application.
This can include things like initializing serial ports or run a memory
check. It all depends on the hardware.

2. Zero the BSS section. This is for uninitialized data. All the addresses
in this section need to be initialized to zero so that programs that forget
to check new variables default value will get unpredictable results.

3. Call main() This is what basically starts things running. If your ROM
monitor supports it, then first setup argc and argv for command line arguments
and an environment pointer. Then branch to main().  For G++ the the main()
routine gets a branch to __main() inserted by the code generator at the
very top. __main() is used by G++ to initialize it's internal tables.
__main() then returns back to your original main() and your code gets
executed.

4. Call exit() After main() has returned, you need to cleanup things and
return control of the hardware from the application. On some hardware, there
is nothing to return to, especially if your program is in ROM.  Sometimes
the best thing to do in this case is do a hardware reset, or branch back
to the start address all over again.
--------------------------- clip -----------------------------------------

Cheers, Kai


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-06-29  2:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-28 23:48 compile error timntsai
2000-06-29  2:37 ` Kai Ruottu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).