[PATCH v5] coresight: etm4x: avoid build failure with unrolled loops

David Laight David.Laight at ACULAB.COM
Tue Jun 28 02:40:40 PDT 2022


...
> > Regardless of which compiler or compiler options determine whether a
> > loop can or can't be unrolled, which determines whether
> > __builtin_constant_p evaluates to true when passed an expression using a
> > loop induction variable, it is NEVER safe to allow the preprocessor to
> > construct inline asm like:
> >    asm volatile (".inst (0x160 + (i * 4))" : "=r"(__val));
> >                                   ^ expected constant expression

Can't you use (IIRC) an "=i" constraint with the C expression
so that the compiler evaluates the expression and passes the
correct constant value to the assembler?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


More information about the linux-arm-kernel mailing list