Skip to content

Commit

Permalink
eal/windows: fix build with recent MinGW
Browse files Browse the repository at this point in the history
[ upstream commit c6221c664e52a94baf259a29ea73645496502af1 ]

Windows compilation with cross-mingw on Fedora 39 failed
because MEM_REPLACE_PLACEHOLDER and MEM_RESERVE_PLACEHOLDER were
already defined in the compiler environment:

eal_memory.c:77: error: "MEM_REPLACE_PLACEHOLDER" redefined
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winnt.h:5710: note:
this is the location of the previous definition

eal_memory.c:78: error: "MEM_RESERVE_PLACEHOLDER" redefined
/usr/x86_64-w64-mingw32/sys-root/mingw/include/winnt.h:5715: note:
this is the location of the previous definition

The patch masks MEM_REPLACE_PLACEHOLDER and MEM_RESERVE_PLACEHOLDER
macros if they were pre-defined by compiler.

The patch also masks MEM_COALESCE_PLACEHOLDERS and
MEM_PRESERVE_PLACEHOLDER to prevent similar errors.

Fixes: 2a5d547 ("eal/windows: implement basic memory management")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
  • Loading branch information
getelson-at-mellanox authored and bluca committed Nov 23, 2023
1 parent b7030fd commit f52040e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/librte_eal/windows/eal_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ static VirtualAlloc2_type VirtualAlloc2_ptr;

#ifdef RTE_TOOLCHAIN_GCC

#ifndef MEM_COALESCE_PLACEHOLDERS
#define MEM_COALESCE_PLACEHOLDERS 0x00000001
#endif
#ifndef MEM_PRESERVE_PLACEHOLDER
#define MEM_PRESERVE_PLACEHOLDER 0x00000002
#endif
#ifndef MEM_REPLACE_PLACEHOLDER
#define MEM_REPLACE_PLACEHOLDER 0x00004000
#endif
#ifndef MEM_RESERVE_PLACEHOLDER
#define MEM_RESERVE_PLACEHOLDER 0x00040000
#endif

int
eal_mem_win32api_init(void)
Expand Down

0 comments on commit f52040e

Please sign in to comment.