arm inline assembly 4.8 vs. 4.9

Gene Smith gds@chartertn.net
Tue Mar 10 22:40:00 GMT 2015


The following inline assembly works as I want with gcc 4.8.3 and 
produces the result shown:

__asm (
   "ldr r0, =%[addrOfIoPorts]\n"
   :                                /* no output */
   : [addrOfIoPorts] "g" (&ioPorts) /* input */
   : "r0");                         /* clobber */

  801b9e2:	4822      	ldr	r0, [pc, #136]

But when compiled with 4.9.3 the linker says "undefined reference to 
`r3'. This is because the produced assembly becomes such that r3 looks 
like a constant:

ldr r0, =r3

I have been unable to find a modification to the original code that 
works with 4.9.3. Any ideas or suggestions?

Thanks,
-gene





More information about the Gcc-help mailing list