linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Colannino <james@colannino.org>
To: linux-assembly@vger.kernel.org
Subject: Re: Question about GCC and stack
Date: Mon, 12 Sep 2005 16:15:52 -0700	[thread overview]
Message-ID: <43260C28.6020406@colannino.org> (raw)
In-Reply-To: <17189.59931.532740.834365@eidolon.muppetlabs.com>

Brian Raiter wrote:

>>The subl instruction is pointless, I dont know why it's inserted. It
>>could be just generic stub code that gcc always inserts for
>>allocating stack variables, but as in this case you dont use any, it
>>allocates $0 bytes...I'm sure someone will correct me if there's a
>>good reason for it :)
>>    
>>
>
>I expect that the instructions obtained by the original poster were
>created by gcc without optimization. Run gcc with -O2 or so would
>probably yield a simpler set of instructions.
>  
>

It was without -O2, but when I used -O2, the code was pretty much the 
same.  The only difference was that instead of moving the value 0 into 
eax, xor eax, eax was used to mask out all the bits (equalling 0, and 
I'm assuming that's probably slightly more efficient than moving a value 
into a register.)  Also, instead of the leave instruction, the ebp and 
esp were manipulated manually, I guess because maybe the leave 
instruction, like the enter instruction, is slower?

James

-- 
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/

"You can only find truth with logic if you have already found truth without it." --G. K. Chesterton


  reply	other threads:[~2005-09-12 23:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12 18:09 Question about GCC and stack Tavis Ormandy
2005-09-12 20:50 ` Brian Raiter
2005-09-12 23:15   ` James Colannino [this message]
2005-09-12 23:13 ` James Colannino
  -- strict thread matches above, loose matches on Subject: below --
2005-09-12  6:50 James Colannino

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=43260C28.6020406@colannino.org \
    --to=james@colannino.org \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).