[RFC,7/9] eal/windows: fix rte_page_sizes with Clang on Windows
Checks
Commit Message
Clang on Windows follows MS ABI where enum values are signed 32-bit,
Enum rte_page_size has members valued beyond 2^32. EAL cannot use
-fno-ms-compatibility because its code is OS-dependent. The only option
is to define these values outside enum, but this prohibits using
-fstrict-enums. Another consequence is that enum rte_page_size cannot
be used to hold page size, because on Windows it won't be able to hold
all possible values.
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
lib/librte_eal/common/include/rte_memory.h | 6 ++++++
lib/librte_eal/meson.build | 1 +
2 files changed, 7 insertions(+)
@@ -34,8 +34,14 @@ enum rte_page_sizes {
RTE_PGSIZE_256M = 1ULL << 28,
RTE_PGSIZE_512M = 1ULL << 29,
RTE_PGSIZE_1G = 1ULL << 30,
+/* Work around Clang on Windows being limited to 32-bit underlying type. */
+#if !defined(RTE_TOOLCHAIN_CLANG) || !defined(RTE_EXEC_ENV_WINDOWS)
RTE_PGSIZE_4G = 1ULL << 32,
RTE_PGSIZE_16G = 1ULL << 34,
+#else
+#define RTE_PGSIZE_4G (1ULL << 32)
+#define RTE_PGSIZE_16G (1ULL << 34)
+#endif
};
#define SOCKET_ID_ANY -1 /**< Any NUMA socket. */
@@ -23,6 +23,7 @@ endif
if cc.has_header('getopt.h')
cflags += ['-DHAVE_GETOPT_H', '-DHAVE_GETOPT', '-DHAVE_GETOPT_LONG']
endif
+cflags += '-fno-strict-enums'
sources = common_sources + env_sources
objs = common_objs + env_objs
headers = common_headers + env_headers