John Farmer wrote: > 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. Attribute 'used' ? Andrew.