From: Andrew Cooper Date: Mon, 6 Jun 2016 11:54:40 +0000 (+0000) Subject: Fix _ASM_EXTABLE_HANDLER() to expand preprocessor tokens in its parameters X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1cfb781cfac2e16e29e8d0774bd424a8b1e0e22b;p=people%2Fliuw%2Fxtf.git Fix _ASM_EXTABLE_HANDLER() to expand preprocessor tokens in its parameters Currently it stringises the literal parameter, which can result in a non-expanded token ending up in at the assembler, causing a build failure. Signed-off-by: Andrew Cooper --- diff --git a/include/xtf/extable.h b/include/xtf/extable.h index 5585181..aaa2053 100644 --- a/include/xtf/extable.h +++ b/include/xtf/extable.h @@ -12,6 +12,7 @@ #include #include +#include #ifdef __ASSEMBLY__ @@ -45,7 +46,7 @@ */ #define _ASM_EXTABLE(fault, fixup) \ ".pushsection .ex_table, \"a\";\n" \ - _WORD #fault ", " #fixup ", 0;\n" \ + _WORD STR(fault) ", " STR(fixup) ", 0;\n" \ ".popsection;\n" /** @@ -54,9 +55,9 @@ * @param fixup Fixup address. * @param handler Handler to call. */ -#define _ASM_EXTABLE_HANDLER(fault, fixup, handler) \ - ".pushsection .ex_table, \"a\";\n" \ - _WORD #fault ", " #fixup ", " #handler ";\n" \ +#define _ASM_EXTABLE_HANDLER(fault, fixup, handler) \ + ".pushsection .ex_table, \"a\";\n" \ + _WORD STR(fault) ", " STR(fixup) ", " STR(handler) ";\n" \ ".popsection;\n" struct cpu_regs; diff --git a/include/xtf/macro_magic.h b/include/xtf/macro_magic.h index c2a1143..b498fec 100644 --- a/include/xtf/macro_magic.h +++ b/include/xtf/macro_magic.h @@ -6,6 +6,16 @@ #ifndef XTF_MACRO_MAGIC_H #define XTF_MACRO_MAGIC_H +/** + * Stringise an expression, expanding preprocessor tokens. + * + * @param x Expression to stringise. + */ +/** @cond */ +#define _STR(x) #x +/** @endcond */ +#define STR(x) _STR(x) + /** * Count the number of varadic arguments provided. *