[dpdk-dev] [PATCH 6/6] doc: guide for Windows build using MinGW-w64
dmitry.kozliuk at gmail.com
Mon Feb 17 07:27:18 CET 2020
> Remembered another issue: thread-local storage (TLS) with shared libraries.
> Windows PE doesn't support TLS via special sections, so compilers use TLS
> emulation layer. With static libraries, there are no issues described below.
> The first aspect is a build-time issue of MinGW. When linking to DPDK shared
> libraries, errors occur:
> undefined reference to `__emutls_v.per_lcore__rte_errno'
> undefined reference to `__emutls_v.per_lcore__rte_lcore_id'
> DPDK declares per_lcore__XXX in a map file, but GCC places __thread symbols
> in __emutls_v section, so the proper name to export becomes __emutls_v.XXX.
> This can be worked around by using an additional version script with MinGW,
> as I do in my port , however, the proper solution would be fixing the bug
> on MinGW side . MinGW already converts TLS variable names when generating
> DEF files with `-Wl,--output-def` option (not used by DPDK, just a hint).
Did some research and AFAICT, there is not effortless solution for
efficient per-lcore variables on Windows. While MinGW-w64 has aforementioned
issues (actually, GCC on Windows does), Clang with default TLS options just
generates wrong results when exporting variables from dynamic libraries.
Thread  claims this is a fundamental problem with PE-COFF executable
format, but I honestly lack expertise to tell if this is valid. Microsoft
docs  suggests that exporting __thread variables won't just work. Can
someone from Microsoft or from UNH Lab comment further?
More information about the dev