Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: soltesz AT hotmail DOT com, djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: gcc bug (when optimizing) Date: Fri, 22 May 1998 20:42:29 -0700 Message-ID: <19980523034225.AAB10307@ppp110.cartsys.com> Precedence: bulk At 10:09 5/23/1998 +0200, Archee/CoNTRACT wrote: >hello there ! > >I have a big problame with inline asm. >When I have a procedure, I use __asm__ ("...."), there are jumps in >the asm statement. > >When I set option -O9, and I call the procedure sometimes(more than one) >I got an asssembler error after gcc putted my code into a .S file and >called >as.exe I got a message like this: > > SIMBOL ALREADY DEFINED... > >When I see it by issuing the following command: >gcc -O9 -S code.c > >I can see, it builited my __asm__ code sometimes in the code, it did not >called it with call. > >I think it is an optimizing feature, because call is a waste of speed. > >I donwanna disable that optimizing feature. > > How can I use local simbols in gcc inline asm ? Right. This is because with -O3 or above, functions can be inlined. If you use a label in your asm, and it's inlined multiple times, the function will be multiply defined, and the assembler will barf. Solution: Use local labels. See the Info node "as" "Symbols" "Symbol names". Basically, the labels get single-digit names, and you reference them with "f" or "b" depending on whether the label is forward or back. Example: 0: jmp 0b /* Infinite loop */ Nate Eldredge nate AT cartsys DOT com