comp.lang.ada
 help / color / mirror / Atom feed
From: sk <sknipe@ktc.com>
Subject: Re: assembly generated using gcc -S on a .adb
Date: Mon, 08 Jul 2002 01:31:10 -0500
Date: 2002-07-08T01:31:10-05:00	[thread overview]
Message-ID: <mailman.1026110042.6342.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: fdb03915.0207071855.6d2d8295@posting.google.com

Hi,

> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x18): undefined reference to `main'

If you can find and look at the 'specs' file for the linker,
you will see that "/usr/lib/crt1.o" is automatically part of
any (standard) executable you create.

This file provides a function "_start" which the linker, unless
specifically overridden, assumes is the entry point for the
final executable. 

The "_start" typically does some setup and then calls "main". 
There is a direct correlation between this "main" and the
typical "C" executable "int main (argc ...)". 

As J.Carter notes, look at the GNAT users manual to see how
the "main" is generated by the GNAT compilation process.

> I realize that gcc *is* a c compiler ...
Not really. gcc coordinates the language specific front ends, the
code generation and linking.

> In other words, is there a way for a machine with just gcc 
> installed, to produce an executable from an asm file that was 
> generated from an .adb ??

Yes, but as with any programming language, you need to have all
external references resolvable at link time. Your provided 
example would suggest that this implies you need to supply "main"
and keep hacking until there are no unresolved references. 

-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



      parent reply	other threads:[~2002-07-08  6:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-08  2:55 assembly generated using gcc -S on a .adb KK
2002-07-08  3:15 ` Jeffrey Carter
2002-07-08  6:31 ` sk [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox