eal/x86: fix clang build with -O0

Clang seems to have a bug with asm inside inline function rte_xabort():

rte_rtm.h:56:15: error: invalid operand for inline asm constraint 'i'
        asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory");
                     ^

It is seen only when building with EXTRA_CFLAGS=-O0.

The workaround is to replace the inline function by a macro.

Fixes: ba7468997e ("spinlock: add HTM lock elision for x86")

Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Damjan Marion 2016-06-03 10:15:23 +02:00 committed by Thomas Monjalon
parent c8c33ad7f9
commit f243d9b04b

View File

@ -50,11 +50,10 @@ void rte_xend(void)
asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory");
}
static __attribute__((__always_inline__)) inline
void rte_xabort(const unsigned int status)
{
asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory");
}
/* not an inline function to workaround a clang bug with -O0 */
#define rte_xabort(status) do { \
asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \
} while (0)
static __attribute__((__always_inline__)) inline
int rte_xtest(void)