diff mbox series

libstdc++-v3: Check for TLS support on mingw

Message ID 1519030763.2942755.1275455464.4F3B5B67@webmail.messagingengine.com
State New
Headers show
Series libstdc++-v3: Check for TLS support on mingw | expand

Commit Message

Hugo Beauzée-Luyssen Feb. 19, 2018, 8:59 a.m. UTC
libstdc++-v3: Check for TLS support on mingw

2018-02-16  Hugo Beauzée-Luyssen  <hugo@beauzee.fr>

    * crossconfig.m4: Check for TLS support on mignw
    * configure: regenerate

Comments

Jonathan Wakely Feb. 26, 2018, 9:04 p.m. UTC | #1
Apologies if you get this mail multiple times, I'm having some trouble
sending mail to @gcc.gnu.org lists.



On 19/02/18 09:59 +0100, Hugo Beauzée-Luyssen wrote:
> libstdc++-v3: Check for TLS support on mingw
>
> 2018-02-16  Hugo Beauzée-Luyssen  <hugo@beauzee.fr>
>
>    * crossconfig.m4: Check for TLS support on mignw

Typo "minwg"

>    * configure: regenerate
>
> Index: libstdc++-v3/crossconfig.m4
> ===================================================================
> --- libstdc++-v3/crossconfig.m4 (revision 257730)
> +++ libstdc++-v3/crossconfig.m4 (working copy)
> @@ -197,6 +197,7 @@ case "${host}" in
>     GLIBCXX_CHECK_LINKER_FEATURES
>     GLIBCXX_CHECK_MATH_SUPPORT
>     GLIBCXX_CHECK_STDLIB_SUPPORT
> +    GCC_CHECK_TLS
>     ;;
>   *-netbsd*)
>     SECTION_FLAGS='-ffunction-sections -fdata-sections'

Hi, thanks for the patch. I don't think we can apply it now, as the
GCC trunk is only open for regression fixes until GCC 8 is released.

How was this tested? Will it work for all versions of mingw that we
support? Is TLS enabled for native builds? (If so we definitely need
this, because otherwise mingw cross-compilers are not ABI compatibnle
with native ones).
Jonathan Wakely Aug. 31, 2021, 9:02 a.m. UTC | #2
It looks like my questions about this patch never got an answer, and
it never got applied.

Could somebody say whether TLS is enabled for native *-*-mingw*
builds? If it is, then we definitely need to add GCC_CHECK_TLS to the
cross-compiler config too.

For a linux-hosted x86_64-w64-mingw32 cross compiler I see TLS is not enabled:

/* Define to 1 if the target supports thread-local storage. */
/* #undef _GLIBCXX_HAVE_TLS */




On Mon, 19 Feb 2018 at 08:59, Hugo Beauzée-Luyssen <hugo@beauzee.fr> wrote:
>
> libstdc++-v3: Check for TLS support on mingw
>
> 2018-02-16  Hugo Beauzée-Luyssen  <hugo@beauzee.fr>
>
>     * crossconfig.m4: Check for TLS support on mignw
>     * configure: regenerate
>
> Index: libstdc++-v3/crossconfig.m4
> ===================================================================
> --- libstdc++-v3/crossconfig.m4 (revision 257730)
> +++ libstdc++-v3/crossconfig.m4 (working copy)
> @@ -197,6 +197,7 @@ case "${host}" in
>      GLIBCXX_CHECK_LINKER_FEATURES
>      GLIBCXX_CHECK_MATH_SUPPORT
>      GLIBCXX_CHECK_STDLIB_SUPPORT
> +    GCC_CHECK_TLS
>      ;;
>    *-netbsd*)
>      SECTION_FLAGS='-ffunction-sections -fdata-sections'
lhmouse Aug. 31, 2021, 2:29 p.m. UTC | #3
在 2021-08-31 17:02, Jonathan Wakely 写道:
> It looks like my questions about this patch never got an answer, and
> it never got applied.
> 
> Could somebody say whether TLS is enabled for native *-*-mingw*
> builds? If it is, then we definitely need to add GCC_CHECK_TLS to the
> cross-compiler config too.
> 
> For a linux-hosted x86_64-w64-mingw32 cross compiler I see TLS is not enabled:
> 
> /* Define to 1 if the target supports thread-local storage. */
> /* #undef _GLIBCXX_HAVE_TLS */
> 

I have been disabling it with `--disable-tls` for years, but... I couldn't remember why. Thread-local storage is implemented with emutls, no matter with or without this option.

Does 'thread-local storage' mean to access thread-local objects via the FS or GS register on x86? If so, then it is definitely not supported yet.
Jonathan Yong Sept. 1, 2021, 1:46 a.m. UTC | #4
On 8/31/21 9:02 AM, Jonathan Wakely wrote:
> It looks like my questions about this patch never got an answer, and
> it never got applied.
> 
> Could somebody say whether TLS is enabled for native *-*-mingw*
> builds? If it is, then we definitely need to add GCC_CHECK_TLS to the
> cross-compiler config too.
> 
> For a linux-hosted x86_64-w64-mingw32 cross compiler I see TLS is not enabled:
> 
> /* Define to 1 if the target supports thread-local storage. */
> /* #undef _GLIBCXX_HAVE_TLS */
> 
> 
> 
> 
> On Mon, 19 Feb 2018 at 08:59, Hugo Beauzée-Luyssen <hugo@beauzee.fr> wrote:
>>
>> libstdc++-v3: Check for TLS support on mingw
>>
>> 2018-02-16  Hugo Beauzée-Luyssen  <hugo@beauzee.fr>
>>
>>      * crossconfig.m4: Check for TLS support on mignw
>>      * configure: regenerate
>>
>> Index: libstdc++-v3/crossconfig.m4
>> ===================================================================
>> --- libstdc++-v3/crossconfig.m4 (revision 257730)
>> +++ libstdc++-v3/crossconfig.m4 (working copy)
>> @@ -197,6 +197,7 @@ case "${host}" in
>>       GLIBCXX_CHECK_LINKER_FEATURES
>>       GLIBCXX_CHECK_MATH_SUPPORT
>>       GLIBCXX_CHECK_STDLIB_SUPPORT
>> +    GCC_CHECK_TLS
>>       ;;
>>     *-netbsd*)
>>       SECTION_FLAGS='-ffunction-sections -fdata-sections'

According to MSYS2 native from 
https://mirror.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-gcc-10.3.0-5-any.pkg.tar.zst:

x86_64-w64-mingw32/bits/c++config.h:#define _GLIBCXX_HAVE_TLS 1

So yes.
Jonathan Wakely Sept. 1, 2021, 9:52 a.m. UTC | #5
On Wed, 1 Sept 2021 at 02:44, Jonathan Yong <10walls@gmail.com> wrote:
>
> On 8/31/21 9:02 AM, Jonathan Wakely wrote:
> > It looks like my questions about this patch never got an answer, and
> > it never got applied.
> >
> > Could somebody say whether TLS is enabled for native *-*-mingw*
> > builds? If it is, then we definitely need to add GCC_CHECK_TLS to the
> > cross-compiler config too.
> >
> > For a linux-hosted x86_64-w64-mingw32 cross compiler I see TLS is not enabled:
> >
> > /* Define to 1 if the target supports thread-local storage. */
> > /* #undef _GLIBCXX_HAVE_TLS */
> >
> >
> >
> >
> > On Mon, 19 Feb 2018 at 08:59, Hugo Beauzée-Luyssen <hugo@beauzee.fr> wrote:
> >>
> >> libstdc++-v3: Check for TLS support on mingw
> >>
> >> 2018-02-16  Hugo Beauzée-Luyssen  <hugo@beauzee.fr>
> >>
> >>      * crossconfig.m4: Check for TLS support on mignw
> >>      * configure: regenerate
> >>
> >> Index: libstdc++-v3/crossconfig.m4
> >> ===================================================================
> >> --- libstdc++-v3/crossconfig.m4 (revision 257730)
> >> +++ libstdc++-v3/crossconfig.m4 (working copy)
> >> @@ -197,6 +197,7 @@ case "${host}" in
> >>       GLIBCXX_CHECK_LINKER_FEATURES
> >>       GLIBCXX_CHECK_MATH_SUPPORT
> >>       GLIBCXX_CHECK_STDLIB_SUPPORT
> >> +    GCC_CHECK_TLS
> >>       ;;
> >>     *-netbsd*)
> >>       SECTION_FLAGS='-ffunction-sections -fdata-sections'
>
> According to MSYS2 native from
> https://mirror.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-gcc-10.3.0-5-any.pkg.tar.zst:
>
> x86_64-w64-mingw32/bits/c++config.h:#define _GLIBCXX_HAVE_TLS 1
>
> So yes.

Thanks! I'll test the patch on a cross-compiler and apply it soon then.

(Thanks also to LH for the answer)
Jonathan Wakely Sept. 15, 2021, 8:53 a.m. UTC | #6
On Wed, 1 Sept 2021 at 10:52, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Wed, 1 Sept 2021 at 02:44, Jonathan Yong <10walls@gmail.com> wrote:
> >
> > On 8/31/21 9:02 AM, Jonathan Wakely wrote:
> > > It looks like my questions about this patch never got an answer, and
> > > it never got applied.
> > >
> > > Could somebody say whether TLS is enabled for native *-*-mingw*
> > > builds? If it is, then we definitely need to add GCC_CHECK_TLS to the
> > > cross-compiler config too.
> > >
> > > For a linux-hosted x86_64-w64-mingw32 cross compiler I see TLS is not enabled:
> > >
> > > /* Define to 1 if the target supports thread-local storage. */
> > > /* #undef _GLIBCXX_HAVE_TLS */
> > >
> > >
> > >
> > >
> > > On Mon, 19 Feb 2018 at 08:59, Hugo Beauzée-Luyssen <hugo@beauzee.fr> wrote:
> > >>
> > >> libstdc++-v3: Check for TLS support on mingw
> > >>
> > >> 2018-02-16  Hugo Beauzée-Luyssen  <hugo@beauzee.fr>
> > >>
> > >>      * crossconfig.m4: Check for TLS support on mignw
> > >>      * configure: regenerate
> > >>
> > >> Index: libstdc++-v3/crossconfig.m4
> > >> ===================================================================
> > >> --- libstdc++-v3/crossconfig.m4 (revision 257730)
> > >> +++ libstdc++-v3/crossconfig.m4 (working copy)
> > >> @@ -197,6 +197,7 @@ case "${host}" in
> > >>       GLIBCXX_CHECK_LINKER_FEATURES
> > >>       GLIBCXX_CHECK_MATH_SUPPORT
> > >>       GLIBCXX_CHECK_STDLIB_SUPPORT
> > >> +    GCC_CHECK_TLS
> > >>       ;;
> > >>     *-netbsd*)
> > >>       SECTION_FLAGS='-ffunction-sections -fdata-sections'
> >
> > According to MSYS2 native from
> > https://mirror.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-gcc-10.3.0-5-any.pkg.tar.zst:
> >
> > x86_64-w64-mingw32/bits/c++config.h:#define _GLIBCXX_HAVE_TLS 1
> >
> > So yes.
>
> Thanks! I'll test the patch on a cross-compiler and apply it soon then.
>
> (Thanks also to LH for the answer)

I've pushed this to trunk now. Thanks for the patch, Hugo. Sorry it
took so long to process.
diff mbox series

Patch

Index: libstdc++-v3/crossconfig.m4
===================================================================
--- libstdc++-v3/crossconfig.m4 (revision 257730)
+++ libstdc++-v3/crossconfig.m4 (working copy)
@@ -197,6 +197,7 @@  case "${host}" in
     GLIBCXX_CHECK_LINKER_FEATURES
     GLIBCXX_CHECK_MATH_SUPPORT
     GLIBCXX_CHECK_STDLIB_SUPPORT
+    GCC_CHECK_TLS
     ;;
   *-netbsd*)
     SECTION_FLAGS='-ffunction-sections -fdata-sections'