delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/04/00:57:07

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Optimization and Inline ASM
Date: Thu, 03 Oct 1996 23:01:13 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 23
Message-ID: <3254A829.3240@cs.com>
References: <1 DOT 5 DOT 4 DOT 32 DOT 19961003225301 DOT 00701b94 AT mail DOT interlog DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp218.cs.com
Mime-Version: 1.0
To: Farhan Yousaf <farhany AT interlog DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Farhan Yousaf wrote:
> [snip]
> What am I doing wrong? Help me, or I'll be bold soon! This error has driven
> me NUTS!!!

By using the -O3 switch you are instructing gcc to inline as many
functions as possible.  Apparently it thinks that your asm function is
sufficiently simple to inline, and thus goes about placing multiple
copies of it around your program.  This, naturally, causes the labels
'loc1' and 'loc2' to be defined in multipla places, causing the
assembler to have a conniption.

The solution to this involves using relative labels instead of absolute
ones, but I don't recall exactly what it is.  Look in the asm chapter of
the gcc docs for more details.  I _think_ that you need to define your
labels as '0:', '1:', etc., but I'm not sure.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
| Plan:  To find ANYONE willing to |   http://www.cs.com/fighteer   |
| play Descent 2 on DWANGO!        | Tagline: <this space for rent> |
---------------------------------------------------------------------

- Raw text -


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