From edd66d57d55c9a19f0cf0a9d38fb1506573e5181 Mon Sep 17 00:00:00 2001 From: Pallavi Kadam Date: Mon, 21 Dec 2020 16:45:10 -0800 Subject: [PATCH] eal/windows: add random function The file rte_random.c is required to build i40e PMD on Windows. Add rte_rand variable to export file. Redefine _m_prefetchw for Clang toolchain due to following error with respect to conflicting types: FAILED: lib/76b5a35@@rte_eal@sta/librte_eal_common_rte_random.c.obj clang @lib/76b5a35@@rte_eal@sta/librte_eal_common_rte_random.c.obj.rsp In file included from ../lib/librte_eal/common/rte_random.c:13: In file included from ..\lib/librte_eal/include\rte_eal.h:20: In file included from ..\lib/librte_eal/include\rte_per_lcore.h:25: In file included from ..\lib/librte_eal/windows/include\pthread.h:21: In file included from ..\lib/librte_eal/windows/include\rte_windows.h:27: In file included from C:\Program Files (x86)\Windows Kits\10\include\ 10.0.18362.0\um\windows.h:171: In file included from C:\Program Files (x86)\Windows Kits\10\include\ 10.0.18362.0\shared\windef.h:24: In file included from C:\Program Files (x86)\Windows Kits\10\include\ 10.0.18362.0\shared\minwindef.h:182: C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\ winnt.h:3324:1: error: conflicting types for '_m_prefetchw' _m_prefetchw ( ^ C:\Program Files\LLVM\lib\clang\10.0.0\include\prfchwintrin.h:50:1: note: previous definition is here _m_prefetchw(void *__P) ^ 1 error generated. Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon --- lib/librte_eal/common/meson.build | 1 + lib/librte_eal/rte_eal_exports.def | 1 + lib/librte_eal/windows/include/rte_windows.h | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index 39abf7a0a4..98e8fffd46 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -33,6 +33,7 @@ if is_windows 'malloc_heap.c', 'rte_malloc.c', 'eal_common_timer.c', + 'rte_random.c', 'rte_service.c', ) subdir_done() diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index f12832cab5..fe27bffe45 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -127,6 +127,7 @@ EXPORTS rte_memzone_reserve_bounded rte_memzone_walk rte_openlog_stream + rte_rand rte_realloc rte_rtm_supported rte_service_attr_get diff --git a/lib/librte_eal/windows/include/rte_windows.h b/lib/librte_eal/windows/include/rte_windows.h index b82af34f6d..0063b5d78c 100644 --- a/lib/librte_eal/windows/include/rte_windows.h +++ b/lib/librte_eal/windows/include/rte_windows.h @@ -18,6 +18,12 @@ #define WIN32_LEAN_AND_MEAN #endif +/* Override Windows SDK definition of _m_prefetchw to avoid conflicting types */ +#ifdef RTE_TOOLCHAIN_CLANG +#undef _m_prefetchw +#define _m_prefetchw __m_prefetchw +#endif + /* Must come first. */ #include -- 2.20.1