From: "J.S.Souza" <jssouza@pacbell.net>
To: linux-assembly@vger.kernel.org
Subject: Re: ld error
Date: Tue, 28 May 2002 05:54:35 -0700 [thread overview]
Message-ID: <200205281254.FAA16891@gold.he.net> (raw)
In-Reply-To: <m31ybwsuxv.fsf@wobble.eth.net>
No, "main" doesn't have any special significance in assembly and is NOT
required. However, the assembler _does_ look for a procedure named "_start",
but this also is not required because it will default to something else and
just give you a warning about it if it's not included. BTW, I understand how
you feel about pulling your hair out, but this is the best way to learn _any_
language. Also, all you really need to do to assemble and link a program is
the following:
as -o hello.o hello
ld -o hello hello.o
All the other stuff is just extra. I usually assembly my programs with
--gstabs so that I can debug them with gdb, but it's not necessary for the
program to assemble. --gstabs is the same as the -g when compiling C
programs.
Cheers,
Jeff Souza
On Monday 27 May 2002 10:27 pm, G Anna wrote:
> > Date: Mon, 27 May 2002 20:27:52 +0200
> > From: Alfred.Cleve@t-online.de (Alfred Cleve)
> > Subj: Re: ld error
> >
> > Hi,
> >
> > > I am working through 'Linux Assembly "Hello World" Tutorial, CS 200'
> > > by Bjorn Chambless. But I am unable to compile the program given in
> > > that. Kindly help me.
> >
> > i suspect that exercise isn't a simple "hello world"-program. It
> > seems to me as a nasty trap for lazy students :-))
> >
> > The module "average" is a subroutine e.g. a "function" which should
> > be linked to a given C-Program.
>
> I don't think so, because the given assembly program has a main
> function; and the tutorial has given a step by step procedure to
> produce the executable.
>
> Inspite of my above statement, I am not very sure of the given
> assembly program being complete, basically because it doesn't work!
> But it does have a main function.
>
> [ Added as an after-thought: Doesn't the function named 'main' have
> any special significance in assembly language programs? ]
>
> (begin-quote)
>
> /* segment registers set up by linked code */
> /* beginning of text(code) segment */
> .text
> .align 4 /* set 4 double-word alignment */
> .globl main /* make main global for linker */
> .type main,@function /* declare main as a function */
> main:
> (definition of main snipped)
>
> (end-quote)
>
> If what you say is correct, then I don't think the tutorial serves its
> purpose. Already, I am pulling my hairs to understand what is going
> on, and now I have got to put up with the caveats that the author
> thought to be educational. (No offence meant to the author, its just
> my critique of the tutorial.)
>
> > For my first step i'm looking for a readable tutorial to the
> > "gas"-assembler.
>
> Simply start from http://www.linuxassembly.org
>
> Cheers,
> anna
next prev parent reply other threads:[~2002-05-28 12:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-27 7:19 ld error G Anna
2002-05-27 18:27 ` Alfred Cleve
2002-05-28 5:27 ` G Anna
2002-05-28 11:26 ` Brian Raiter
2002-05-28 14:32 ` Robert Plantz
2002-05-28 12:54 ` J.S.Souza [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-05-27 18:58 Emmet Ford
2002-05-28 1:51 ` Brian Raiter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200205281254.FAA16891@gold.he.net \
--to=jssouza@pacbell.net \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).