🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #49936

Assembly for 386 using gcc??

#49936
From: Doug Evans
Date: Tue, 07 Dec 1993 16:44
47 lines
1573 bytes
Gack.

(I should learn to review my messages first).

You write:

   At the lines with "mov ebp,esp" and "xor ebx,ebx" for example I got the
   error message "operands given don't match any known 386 instruction".

What you could do is study the assembler output from gcc.
Using either the -S or -save-temps option, compile a simple .c file
and then study the .s.  This may give you enough of a clue.

I did this on an SCO 3.2v4 system for foo.c and got:

foo.c:
foo(int a, int b) { return a ^ b; }

gcc -O -S foo.c
foo.s:
	.file	"foo.c"
gcc2_compiled.:
__gnu_compiled_c:
.text
	.align 16
.globl foo
foo:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%eax
	xorl 12(%ebp),%eax
	movl %ebp,%esp
	popl %ebp
	ret

(If you add the -fomit-frame-pointer option you get):

	.file	"foo.c"
gcc2_compiled.:
__gnu_compiled_c:
.text
	.align 16
.globl foo
foo:
	movl 4(%esp),%eax
	xorl 8(%esp),%eax
	ret
Technical Details
Message-ID: <9312071640.AA28783@cygnus.com>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cygnus.com!dje
References: <gnusenet931206154844_100273.171_BHB50-1@CompuServe.COM>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,947f853ad322703d
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-12-08 16:32:59 PST
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cygnus.com!dje
From: dje@cygnus.com (Doug Evans)
Newsgroups: gnu.gcc.help
Subject: Assembly for 386 using gcc??
Date: 7 Dec 1993 11:44:36 -0500
Organization: GNUs Not Usenet
Lines: 47
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Message-ID: <9312071640.AA28783@cygnus.com>
References: <gnusenet931206154844_100273.171_BHB50-1@CompuServe.COM>