"Undefined reference to ..." Errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a module static variable that is not referenced by any C code but is
referenced by non-extended __asm__() statements similar to this.


static int MyInt;
.
.
.
void f(void)
{

 __asm__("ldr r8, =MyInt\n" ...);

}

The problem is that when I build my release version I get "Undefined
reference to MyInt" linker errors. I use the -Wunused compiler option for
the release build to catch anything not referenced that I had forgotten to
remove during debug. In general I would like to keep this option but perhaps
selectively disable it for a particular data definition in a particular
module if necessary.

I have tried using the "unused" attribute for the data definition which
removes the compiler warning "MyInt defined but not used" but still gives me
the linker error.

It occurs to me that perhaps the right way to remove this error is to get
asm to recognise the variable as it would if using extended asm statements
but I cannot how a way to do this. Perhaps someone could enlighten me or
maybe there is another solution.

Regards
-- 
View this message in context: http://www.nabble.com/%22Undefined-reference-to-...%22-Errors-tp23411190p23411190.html
Sent from the gcc - Help mailing list archive at Nabble.com.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux