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

From: David Laight
Date: Tue Jun 28 2022 - 05:40:53 EST


...
> > 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)