Pushes, Pops, NOPS

vbjohny@yahoo.com (Kalyan)
3 Dec 2003 20:27:22 -0500

          From comp.compilers

Related articles
Pushes, Pops, NOPS vbjohny@yahoo.com (2003-12-03)
Re: Pushes, Pops, NOPS Barak.Zalstein@ParthusCeva.com (Barak Zalstein) (2003-12-08)
Re: Pushes, Pops, NOPS tmk@netvision.net.il (2003-12-08)
Re: Pushes, Pops, NOPS nick.roberts@acm.org (Nick Roberts) (2003-12-08)
Re: Pushes, Pops, NOPS kenrose@tfb.com (Ken Rose) (2003-12-08)
Re: Pushes, Pops, NOPS vbdis@aol.com (2003-12-08)
Re: Pushes, Pops, NOPS lex@cc.gatech.edu (Lex Spoon) (2003-12-13)
| List of all articles for this month |
From: vbjohny@yahoo.com (Kalyan)
Newsgroups: comp.compilers
Date: 3 Dec 2003 20:27:22 -0500
Organization: http://groups.google.com
Keywords: architecture, question
Posted-Date: 03 Dec 2003 20:27:22 EST

Hello
I have a question regarding assembly language. Suppose we have a 10
to 12 line code in assembly language(The purpose of the code is not
important here, because i have a different objective explained
below).It is as follows:


void main() {
__asm__("
jmp 0x2a
popl %esi
movl %esi,0x8(%esi)
movb $0x0,0x7(%esi)
movl $0x0,0xc(%esi)
movl $0xb,%eax
movl %esi,%ebx
leal 0x8(%esi),%ecx
leal 0xc(%esi),%edx
int $0x80
movl $0x1, %eax
movl $0x0, %ebx
int $0x80
call -0x2f
.string \"/bin/sh\"
");
}


If I added some "NOPS" in between each of the instructions above just
to make the code look bigger, is there any option while compiling with
GCC which would eliminate all those unnecessary "NOPS" and then
convert the remaining code to binary?


Also are there any open source assemblers which would convert the
above assembly program to binary by eliminating unnecessary NOPS? My
objective is to eliminate unnecessary "NOPS" wherever they are and
also unnecessary pushes and pops, for eg., we hav push eax and
immediately following that a pop eax. I want to eliminate such
instructions. Could anyone please tell me if there are any freeware
or shareware assembler or compiler tools that would eliminate these
unnecessary instructions?


Thank you.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.