On Wed, 29 Nov 2023, Antonin Décimo wrote:
Le mer. 29 nov. 2023 à 12:32, Martin Storsjö <[email protected]> a écrit :
On Wed, 29 Nov 2023, Antonin Décimo wrote:
> Signed-off-by: Antonin Décimo <[email protected]>
> ---
> mingw-w64-libraries/winpthreads/src/thread.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/mingw-w64-libraries/winpthreads/src/thread.c
b/mingw-w64-libraries/winpthreads/src/thread.c
> index 7c5e75f91..16b13b07c 100644
> --- a/mingw-w64-libraries/winpthreads/src/thread.c
> +++ b/mingw-w64-libraries/winpthreads/src/thread.c
> @@ -508,11 +508,25 @@ __dyn_tls_pthread (HANDLE hDllHandle, DWORD dwReason,
LPVOID lpreserved)
>
> /* TLS-runtime section variable. */
> #ifdef _MSC_VER
> -#pragma section(".CRT$XLF", shared)
> +# ifdef _WIN64
> +/* .CRT section is merged with .rdata on x64 so it must be constant data. */
This patch assumes that _WIN64 is enough to determine between x86 and x64,
but does the distinction also hold up for ARM and ARM64? As current public
MSVC releases support all these 4 architectures, I would suggest checking
what the situation is wrt these on all 4 architectures before adding
ifdefs like this.
Thanks for the review!
The page at Microsoft-specific predefined macros [1] has some
information about the macros.
- _WIN32 Defined as 1 when the compilation target is 32-bit ARM,
64-bit ARM, x86, or x64. Otherwise, undefined.
- _WIN64 Defined as 1 when the compilation target is 64-bit ARM or
x64. Otherwise, undefined.
There are also some arch-specific macros, such as _M_AMD64, _M_ARM64, etc.
https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170#microsoft-specific-predefined-macros
Does that answer your question?
No, that doesn't answer the question.
Your patch makes the distinction that x86 should use #pragma data_seg,
while x64 should use #pragma const_seg.
Your patch also makes ARM use data_seg and ARM64 use const_seg. I don't
see anything specifically that indicates that pointer size should affect
which section is used for these pointers on ARM platforms.
Therefore: Check which one should be used for ARM and ARM64, whichever way
you used to check this for x86 and x64, and update your ifdef conditions
to match this. I doubt that _WIN64 is the right distinction.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public