Re: [arm-gnu] load constructed constant in arm inline assembly - how?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] load constructed constant in arm inline assembly - how?



On Thu, 2005-09-01 at 17:57, Paul Brook wrote:
> On Thursday 01 September 2005 17:46, Kurt Kennett wrote:
> > hi.
> >
> > I'm trying to do this:
> >
> > ldr r0, =<32-bit constant>
> >
> > The thing is, the constant is constructed at compile time in the .cpp file
> > that is invoking the arm inline assembler:
> 
> #define FOO 42
> void bar()
> {
>   asm volatile (
>     "ldr r0, =%a0"
>     :
>     : "i"( 0xC0000000 | FOO)
>     : "r0");
> }
> 
> Paul

This is unsafe, and may cause the compiler and/or the assembler to blow
up.

R.