delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/19/10:16:39.1

Message-Id: <199903191515.KAA24431@delorie.com>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk>
To: Nate Eldredge <nate AT cartsys DOT com>
Date: Fri, 19 Mar 1999 15:12:55 +0000
MIME-Version: 1.0
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019