[MacPorts] #52585: libcxxabi -- attempts to add thread-local-storage (TLS) to <10.9

MacPorts noreply at macports.org
Mon Feb 19 06:23:07 UTC 2018


#52585: libcxxabi -- attempts to add thread-local-storage (TLS) to <10.9
------------------------------------+--------------------------------
  Reporter:  ken-cunningham-webuse  |      Owner:  macports-tickets@…
      Type:  defect                 |     Status:  new
  Priority:  Normal                 |  Milestone:
 Component:  ports                  |    Version:  2.3.4
Resolution:                         |   Keywords:
      Port:  libcxxabi              |
------------------------------------+--------------------------------

Comment (by kencu):

 I think I can see where this comes in. If you have thead_local variables
 that have non-trivial destructors, then we're still missing some
 functionality in 10.6.8 and lower.

 e.g. building FileZilla

 this:
 {{{
 thread_local std::map<std::wstring, std::unique_ptr<wxCSConv>>
 converters_;
 thread_local std::vector<char> toServerBuffer_;
 thread_local std::vector<wchar_t> toLocalBuffer_;
 }}}

 generates a link-time error:
 {{{
 Undefined symbols for architecture x86_64:
   "__tlv_atexit", referenced from:
       ___tls_init in filezilla-encoding_converter.o
 ld: symbol(s) not found for architecture x86_64
 }}}

 changing it to this as an experiement:

 {{{
 __thread std::map<std::wstring, std::unique_ptr<wxCSConv>> converters_;
 __thread std::vector<char> toServerBuffer_;
 __thread std::vector<wchar_t> toLocalBuffer_;
 }}}

 suggests what the issue might be:
 {{{
 encoding_converter.cpp:8:60: error: type of thread-local variable has non-
 trivial destruction
 __thread std::map<std::wstring, std::unique_ptr<wxCSConv>> converters_;
                                                            ^
 encoding_converter.cpp:8:60: note: use 'thread_local' to allow this
 encoding_converter.cpp:9:28: error: type of thread-local variable has non-
 trivial destruction
 __thread std::vector<char> toServerBuffer_;
                            ^
 encoding_converter.cpp:9:28: note: use 'thread_local' to allow this
 encoding_converter.cpp:10:31: error: type of thread-local variable has
 non-trivial destruction
 __thread std::vector<wchar_t> toLocalBuffer_;
                               ^
 encoding_converter.cpp:10:31: note: use 'thread_local' to allow this
 }}}





 We'll need `cxa_thread_atexit` I believe, and then fix up the call

 {{{
 Name = T.isOSDarwin() ?  "_tlv_atexit" : "__cxa_thread_atexit";
 }}}
 to point to it.

 However `cxa_thread_atexit` is not presently compiled into libcxx on
 Darwin, and trying to add it to the build runs into some issues, as it
 requires a _thread-capable compiler, and presently won't build with
 clang-5.0 due to other issues.

 Probably have to build `libcxx` with gcc6 or gcc7 to make this work.

--
Ticket URL: <https://trac.macports.org/ticket/52585#comment:8>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list