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 <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
This commit is contained in:
Pallavi Kadam 2020-12-21 16:45:10 -08:00 committed by Thomas Monjalon
parent 5881b2d2d9
commit edd66d57d5
3 changed files with 8 additions and 0 deletions

View File

@ -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()

View File

@ -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

View File

@ -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 <windows.h>