I’m trying to work out why GCC’s emutls_alloc() function is being called in my embedded firmware.
Nothing is calling it explicitly, so it’s a mystery to me so far.
emutls_alloc() calls malloc() which i have redirected to assert() as I want precise control over heap usage (heap alloc is made by other functions).
Thanks in advance.
Seems like libgcc internal function - https://github.com/gcc-mirror/gcc/blob/master/libgcc/emutls.c#L102
Can you put a breakpoint in malloc and examine the call stack to see where is it coming from?
I found the problem.
It was due to the library im using using the __thread attribute on various global variables.
Thank you for reporting back!