Message ID | 20200226201243.86988-8-morbo@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fixes for clang builds | expand |
Hi Bill, Perhaps it would be better to drill down the noclone attribute by GCC version as well. May I suggest the following? diff --git a/lib/compiler.h b/lib/compiler.h new file mode 100644 index 000000000000..5cbcda94b0fe --- /dev/null +++ b/lib/compiler.h @@ -0,0 +1,12 @@ +#ifndef _LIB_COMPILER_H_ +#define _LIB_COMPILER_H_ + +#if GCC_VERSION >= 40500 +#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) +#endif /* GCC_VERSION >= 40500 */ + +#if !defined(__noclone) +#define __noclone +#endif + +#endif /* _LIB_COMPILER_H_ */ diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 0e2c2f8a7d34..2dfc010d5d49 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -5,6 +5,7 @@ */ #include <asm/debugreg.h> +#include <compiler.h> #include "vmx.h" #include "msr.h" @@ -4974,7 +4975,7 @@ extern unsigned char test_mtf1; extern unsigned char test_mtf2; extern unsigned char test_mtf3; -__attribute__((noclone)) static void test_mtf_guest(void) +__noclone static void test_mtf_guest(void) { asm ("vmcall;\n\t" "out %al, $0x80;\n\t"
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index ad8c002..ec88016 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -4976,7 +4976,10 @@ extern unsigned char test_mtf1; extern unsigned char test_mtf2; extern unsigned char test_mtf3; -__attribute__((noclone)) static void test_mtf_guest(void) +#ifndef __clang__ +__attribute__((noclone)) +#endif +static void test_mtf_guest(void) { asm ("vmcall;\n\t" "out %al, $0x80;\n\t"
Don't use the "noclone" attribute for clang as it's not supported. Signed-off-by: Bill Wendling <morbo@google.com> --- x86/vmx_tests.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)