From 57d55aaded3414c20118629a45495b440affee4b Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Sun, 10 Jun 2018 13:30:43 -0600 Subject: [PATCH] buildilb: Fix -msse breakage on ARM builds Travis was broken when this patch was accepted, so this was missed. Non-x86 arches do not like the attribute(target) on main, so conditionalize the entire thing. Cc: stable@linux-rdma.org # v15 Signed-off-by: Jason Gunthorpe --- buildlib/RDMA_EnableCStd.cmake | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/buildlib/RDMA_EnableCStd.cmake b/buildlib/RDMA_EnableCStd.cmake index 9bda71bb4..5f9bdb8b0 100644 --- a/buildlib/RDMA_EnableCStd.cmake +++ b/buildlib/RDMA_EnableCStd.cmake @@ -58,22 +58,24 @@ endfunction() function(RDMA_Check_SSE TO_VAR) set(SSE_CHECK_PROGRAM " - #include - #if defined(__i386__) - #include - #endif - int __attribute__((target(\"sse\"))) main(int argc, char *argv[]) - { - int ret = 0; - - #if defined(__i386__) +#if defined(__i386__) +#include +#include +int __attribute__((target(\"sse\"))) main(int argc, char *argv[]) +{ __m128 tmp = {}; + tmp = _mm_loadl_pi(tmp, (__m64 *)&main); _mm_storel_pi((__m64 *)&main, tmp); - ret = memchr(&tmp, 0, sizeof(tmp)) == &tmp; - #endif - return ret; - }") + return memchr(&tmp, 0, sizeof(tmp)) == &tmp; +} +#else +int main(int argc, char *argv[]) +{ + return 0; +} +#endif +") CHECK_C_SOURCE_COMPILES( "${SSE_CHECK_PROGRAM}"