www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/01/17:15:09

From: Fabrizio Da Ros <fabrium AT libero DOT it>
Newsgroups: comp.os.msdos.djgpp
Subject: Asm jmp and C label - link error: undefined reference...
Message-ID: <MPG.158222a0d5002a7f989680@news.libero.it>
X-Newsreader: MicroPlanet Gravity v2.30
Lines: 49
Date: Fri, 01 Jun 2001 21:11:13 GMT
NNTP-Posting-Host: 151.25.42.237
X-Complaints-To: abuse AT libero DOT it
X-Trace: news.infostrada.it 991429873 151.25.42.237 (Fri, 01 Jun 2001 23:11:13 MET DST)
NNTP-Posting-Date: Fri, 01 Jun 2001 23:11:13 MET DST
Organization: [Infostrada]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi, I'm going crazy to solve a little problem, can 
someone help me?
This is the source code:

-------------
#include <stdio.h>

short int a;

void func1 ()
{
     __asm__ __volatile__ (
               "btl $0, _a\n\t"
               "jc boardtest" );
     goto notest;
boardtest:
     printf ("testing...\n");
notest:
     printf ("exiting...\n");
}

int main ()
{
     a = 1;
     func1 ();
}
----------

OK, it's stupid, but this is only an example to explain 
the problem. 
I need to jump with "jc" after testing the bit. The 
problem arises in the link stage:
"undefined reference to boardtest" (in the line where is 
the jc). No way to solve the problem. I tried to prefix 
with on or two _, I tried to put a dummy goto in func1 to 
boardtest, to tell gcc that i NEED that label. The 
problem arises every time. I tried to define the label in 
an asm statament, but is the same. The only way is to 
write the code all in asm, BUT I CAN'T do this in my real 
program.
Another way to solve the problem is to compile with -S 
option to obtain the assembly source, and write in the 
correct location the label "boardtest:", than compile and 
link. But...It's not human!

I have downloaded and installed the entirely DJGPP 
package about 2 mounth ago...

Thank you, Fabrizio.

- Raw text -


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