Bug 21325

Summary: Newlib needs to support C++11 thread_local destructor offloading?
Product: newlib Reporter: Jiong Wang <jiwang>
Component: libcAssignee: Jeff Johnston <jjohnstn>
Status: NEW ---    
Severity: minor    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Jiong Wang 2017-03-29 10:30:57 UTC
The origin of this issue is a test written to verify the destructor of thread_local variable in C++11 is executed correctly.  While that testcase failed on arm/aarch64 bare-metal toolchain which is using GCC emulated TLS and newlib.

On GCC side, a patch has been committed to XFAIL that testcase on newlib while GCC testcase maintainer also commented that a better approach might be to fix newlib as well which I agree.

The discussion and the testcase can be found at this thread:

  https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00547.html

Quick search of glibc code shows glibc support is done by the following commit:

commit ba384f6ed9275f3966505f2375b56d169e3dc588
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Mon Feb 18 19:08:21 2013 +0530

    C++11 thread_local destructors support

We might need similar support in newlib.