linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* different asm code
@ 2013-02-18  5:06 horseriver
  2013-02-18 15:22 ` Hendrik Visage
  0 siblings, 1 reply; 3+ messages in thread
From: horseriver @ 2013-02-18  5:06 UTC (permalink / raw)
  To: linux-assembly

hi:)

  I have compiled a .S file ,using command gcc -c x.S -o x.
  Then I use objdump to look up its asm code, even find that some code is not the
  same as that .S file , more important is , some code in origin  .S file has disappear .
  
  what is about the reason ? If it is due to version , why some code chould get lost after compile?


thanks!

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

* Re: different asm code
  2013-02-18  5:06 different asm code horseriver
@ 2013-02-18 15:22 ` Hendrik Visage
  2013-02-18 15:54   ` Sofiane Akermoun
  0 siblings, 1 reply; 3+ messages in thread
From: Hendrik Visage @ 2013-02-18 15:22 UTC (permalink / raw)
  To: horseriver; +Cc: linux-assembly

On Mon, Feb 18, 2013 at 7:06 AM, horseriver <horserivers@gmail.com> wrote:
> hi:)
>
>   I have compiled a .S file ,using command gcc -c x.S -o x.
>   Then I use objdump to look up its asm code, even find that some code is not the
>   same as that .S file , more important is , some code in origin  .S file has disappear .
>
>   what is about the reason ? If it is due to version , why some code chould get lost after compile?

Give examples please.

There are several "similar"/equivalent code/instructions that the
assembler could chose from.

Ie. to zero a register, you could
1) mov REGISTER,0
2) xor REGISTER, REGISTER
3) mv REGISTER,g0 (on a SPARC where g0 is always zero)

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

* Re: different asm code
  2013-02-18 15:22 ` Hendrik Visage
@ 2013-02-18 15:54   ` Sofiane Akermoun
  0 siblings, 0 replies; 3+ messages in thread
From: Sofiane Akermoun @ 2013-02-18 15:54 UTC (permalink / raw)
  To: Hendrik Visage; +Cc: horseriver, linux-assembly

a nice trick too:
push 0
pop register

We could start writing some metamorphic code to zeroed something :)

Horseriver you really have to search a bit yourself before spamming
this mailling list. I would mean your are sometimes asking question
that could be answerd in few seconds by google.
An advice if you need quick answers for short questions there are
really good irc chan for assembler stuff, freeonde as a good one #asm
and efnet too like #assembly, #win32asm or #asm, you have to try.

for you information, compiler and assembler can choose what is the
best way to generate code, loop etc. If he find something redundant he
can try to optimize it. sometimes he prefers to xor a register to
zeroed it, sometimes he prefers to mov 0 into the register.
You have to check optimization option of your assembler/compiler.

but if you really have something weird or interesting as wrote Hendrik
Visage paste code here.

regards,

Sofiane Akermoun

2013/2/18 Hendrik Visage <hvjunk@gmail.com>:
> On Mon, Feb 18, 2013 at 7:06 AM, horseriver <horserivers@gmail.com> wrote:
>> hi:)
>>
>>   I have compiled a .S file ,using command gcc -c x.S -o x.
>>   Then I use objdump to look up its asm code, even find that some code is not the
>>   same as that .S file , more important is , some code in origin  .S file has disappear .
>>
>>   what is about the reason ? If it is due to version , why some code chould get lost after compile?
>
> Give examples please.
>
> There are several "similar"/equivalent code/instructions that the
> assembler could chose from.
>
> Ie. to zero a register, you could
> 1) mov REGISTER,0
> 2) xor REGISTER, REGISTER
> 3) mv REGISTER,g0 (on a SPARC where g0 is always zero)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Sofiane AKERMOUN
akersof@gmail.com

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

end of thread, other threads:[~2013-02-18 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-18  5:06 different asm code horseriver
2013-02-18 15:22 ` Hendrik Visage
2013-02-18 15:54   ` Sofiane Akermoun

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).