Message-Id: <199903191515.KAA24431@delorie.com> Comments: Authenticated sender is From: "George Foot" To: Nate Eldredge Date: Fri, 19 Mar 1999 15:12:55 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Some assembly questions CC: djgpp AT delorie DOT com X-mailer: Pegasus Mail for Win32 (v2.42a) Reply-To: djgpp AT delorie DOT com On 18 Mar 99 at 17:24, Nate Eldredge wrote: > Alternatively, if you want to leave GCC out of the function entirely, > you can use `asm' at the top level. For instance: > > static int bar(void); > > asm("_bar: movl $42, %eax; ret"); Doesn't this create segment problems, i.e. code is meant to be in a text segment, data in a data segment? ISTR running into a problem with this once, but it may have been on RSXNTDJ, not djgpp. The problem with just being explicit and forcing it with `.code' is that I think gcc might not notice you doing this, and so it can't put it back afterwards itself -- so again you end up guessing which segment it left it in. IMHO the safest thing is to put such assembly code in a separate .S or .s file -- I can't see any real disadvantages with this, but maybe wiser people can or I'm worrying about nothing. -- George