Sameer.Seth | 3 Dec 04:41 2002

stack allocation for array

hi,
    could somebody help me out with this confusion. i wrote a C program and
had an assembly output for that program by giving gcc -S option. the C
program is something like this:

int main()
{
        int  fd[3];
        int pid = 0;
        return 0;
}

+++++++++++++++=+++++++++++++++++++++++=++++++++++++++++++++++++++++++=+++++++++++++++++++++++++++++=+++++++++++++++++++++++==
the .s file created is like this:
        .file   "test_1.c"
        .version        "01.01"
gcc2_compiled.:
.text
        .align 4
.globl main
        .type    main, <at> function
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $40,
%esp-----------------------------------------------------> (why has the
compiler allocated this much space for the
                                          two local variables which would
combinely would have taken 12 bytes)
        movl    $0, -28(%ebp)
(Continue reading)

Anticipating a Reply | 3 Dec 13:06 2002
Picon

Nasm v/s Gas

Hi All ,

   I'am a Assembly learner , working 
on Linux Platform .

   I was not able to decide whether I should
learn assembly programming using NASM or 
GNU-As  .

   As Linux Inline assembly accepts 'gas'
syntax , I would like to know which of 
the two to use .

   So I would like to know what are the 
advantages and disadvantages involved in 
using NASM v/s GNU-As ?

   Thanks in Advance .

Bye,
Sarvesh

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

h-peter recktenwald | 3 Dec 20:05 2002
Picon

Re: stack allocation for array

On Tuesday 03 December 2002 03:41, Sameer.Seth <at> lntinfotech.com wrote:

your question does not relate to assembly, it's a compiler issue.
gcc 'optimization' w. "-O3" might result to less unreasonable code 
("-O2" won't). you can receive a synchronuos asm listing from the 
real, compiled code w. AS listing switches, passed by "-Wa,...." in 
the CFLAGS variable - re AS docs.

best,
	hp

> hi,
>     could somebody help me out with this confusion. i wrote a C program and
> had an assembly output for that program by giving gcc -S option. the C
> program is something like this:
>
> int main()
> {
>         int  fd[3];
>         int pid = 0;
>         return 0;
> }
>
>
> +++++++++++++++=+++++++++++++++++++++++=++++++++++++++++++++++++++++++=++++
>+++++++++++++++++++++++++=+++++++++++++++++++++++== the .s file created is
> like this:
>         .file   "test_1.c"
>         .version        "01.01"
> gcc2_compiled.:
(Continue reading)

h-peter recktenwald | 3 Dec 19:57 2002
Picon

Re: Nasm v/s Gas

On Tuesday 03 December 2002 12:06, Anticipating a Reply wrote:
>
>    So I would like to know what are the
> advantages and disadvantages involved in
> using NASM v/s GNU-As ?

AS, despite it's funny 'syntax`, is reliable(!) and fast and present in 
(almost) any Linux system.

> ________________________________________________________________________
> Missed your favourite TV serial last night? Try the new, Yahoo! TV.
>        visit http://in.tv.yahoo.com

(you might get filtered w. that sort of 'footers'...)

best
	hp

--

-- 
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Jack Dennon | 3 Dec 21:21 2002
Picon

Re: Nasm v/s Gas

I like gas, but I will listen, rather than
answer. Are you trying to start a fight?

Anticipating a Reply wrote:

> Hi All ,
>
>    I'am a Assembly learner , working
> on Linux Platform .
>
>    I was not able to decide whether I should
> learn assembly programming using NASM or
> GNU-As  .
>
>    As Linux Inline assembly accepts 'gas'
> syntax , I would like to know which of
> the two to use .
>
>    So I would like to know what are the
> advantages and disadvantages involved in
> using NASM v/s GNU-As ?
>
>    Thanks in Advance .
>
> Bye,
> Sarvesh
>
> ________________________________________________________________________
> Missed your favourite TV serial last night? Try the new, Yahoo! TV.
>        visit http://in.tv.yahoo.com
(Continue reading)

Robert G. Plantz | 3 Dec 22:33 2002

Re: Nasm v/s Gas

I thought about this issue a lot when we moved to a linux
platform for teaching assembly language. I chose gas because:

1. It already exists on almost all linux systems.
2. The interface between gas and C/C++ is very good in the gnu
    environment. (The whole point of our class is to teach
    what is going on at the asm level when programming in C/C++.)
2a. One can easily generate assembly language from a C/C++
     source with gcc, which provides a valuable learning tool.
3. Students need to learn the concepts, and the minor syntax
    differences actually reinforce this.

I have not taken the time to learn NASM to see if any of
my arguments also apply to NASM. After using gas for four
years, though, I do not regret my decision. It is working
very well for us.

Please note that my comments apply to a teaching environment.
I can easily imagine that other assemblers would be preferable
in a productions environment.

Bob

On Tuesday, December 3, 2002, at 04:06 AM, Anticipating a Reply wrote:

>    As Linux Inline assembly accepts 'gas'
> syntax , I would like to know which of
> the two to use .
>
>    So I would like to know what are the
(Continue reading)

Randall Hyde | 4 Dec 04:35 2002
Picon
Picon

Re: Nasm v/s Gas

Interesting.
In my experience Gas is probably the worst assembly to use
in an educational environment (no pedagogy).  I'm surprised you're
as happy with it as you are.  
(comments follow below).

----- Original Message ----- 
From: "Robert G. Plantz" <plantz <at> SONOMA.EDU>
To: <ruxyz <at> yahoo.com>
Cc: "Assembly Linux" <linux-assembly <at> vger.kernel.org>
Sent: Tuesday, December 03, 2002 1:33 PM
Subject: Re: Nasm v/s Gas

> I thought about this issue a lot when we moved to a linux
> platform for teaching assembly language. I chose gas because:
> 
> 1. It already exists on almost all linux systems.

Yes, in particular it exists on all non-x86 platforms as well (though
I don't know if this was your main consideration).
Most distributions also ship NASM (and have been for the past
year or so, so this is hardly a consideration).  Since almost everyone
has internet access, I seriously doubt this is an important consideration
today since anyone can download NASM, HLA, or just about any other
Linux-compatible assembler today.

> 2. The interface between gas and C/C++ is very good in the gnu
>     environment. (The whole point of our class is to teach
>     what is going on at the asm level when programming in C/C++.)

(Continue reading)

Randall Hyde | 4 Dec 07:07 2002
Picon
Picon

Re: Nasm v/s Gas


----- Original Message ----- 
From: "Robert Plantz" <plantz <at> SONOMA.EDU>
To: "Randall Hyde" <aoax86 <at> earthlink.net>
Sent: Tuesday, December 03, 2002 9:24 PM
Subject: Re: Nasm v/s Gas

> Randy,
> 
> Thank you for your very thoughtful comments. I have consulted your
> online book often and appreciate your expertise in this area.
> 
> I really should take the time to learn NASM
> so I can make a better informed decision. (We have a 12 unit
> teaching load every semester (no TAs), so it's a struggle just
> to keep up.)
> 
> One thing to note is my parenthetical comment:
> 
> >> (The whole point of our class is to teach
> >>     what is going on at the asm level when programming in C/C++.)
> 
> which I should have placed at the beginning.
> 
> We decided many years ago that it was not important for our
> students to learn assembly language programming. Our course
> was renamed "Computer Organization: Software". We really do
> try to show approximately what the compiler is generating.
> We are trying to demystify the machine operations going on
> behind C. Within this context, the course serves as sort of
(Continue reading)

Sameer.Seth | 4 Dec 07:34 2002

Re: stack allocation for array


but with this kind of setup one cannot predict stack overflow problems.
please soneone verify this.

                                                                                                                                               
                      h-peter recktenwald                                                                                                      
                      <hp <at> lxhp.in-berlin.de>           To:       Sameer.Seth <at> lntinfotech.com, linux-assembly <at> vger.kernel.org                   
                      Sent by:                         cc:                                                                                     
                      linux-assembly-owner <at> vger        Subject:  Re: stack allocation for array                                                
                      .kernel.org                                                                                                              

                                                                                                                                               
                      04/12/2002 12:35 AM                                                                                                      

On Tuesday 03 December 2002 03:41, Sameer.Seth <at> lntinfotech.com wrote:

your question does not relate to assembly, it's a compiler issue.
gcc 'optimization' w. "-O3" might result to less unreasonable code
("-O2" won't). you can receive a synchronuos asm listing from the
real, compiled code w. AS listing switches, passed by "-Wa,...." in
the CFLAGS variable - re AS docs.

best,
             hp

> hi,
>     could somebody help me out with this confusion. i wrote a C program
and
> had an assembly output for that program by giving gcc -S option. the C
> program is something like this:
(Continue reading)

Anticipating a Reply | 4 Dec 07:36 2002
Picon

Re: Nasm v/s Gas

Hello Everybody,

   Thank you for all the responses provided 
by all you learned people out there .

    As pointed out in the mails , I too 
was interested in learning Assembly to know
what is going on at the assembly level when
programming in C , so that I can write
HLL code that generates decent assembly.

    I would look forward to Mr.Randall Hyde's
new book which takes this aspect into 
consideration and thank him for his efforts .

    Thank you once again for all your inputs .

Best Regards !   

 --- Randall Hyde <aoax86 <at> earthlink.net> wrote: > 
> ----- Original Message ----- 
> From: "Robert Plantz" <plantz <at> SONOMA.EDU>
> To: "Randall Hyde" <aoax86 <at> earthlink.net>
> Sent: Tuesday, December 03, 2002 9:24 PM
> Subject: Re: Nasm v/s Gas
> 
> 
> > Randy,
> > 
> > Thank you for your very thoughtful comments. I
(Continue reading)


Gmane