Jie Zhang <jie.zh...@analog.com> writes:

> I encountered a recursive call problem between libmudflap and emutls
> when testing libmudflap for Blackfin. But I think this issue affects
> all targets without TLS.

Thank you for the report.

> One libmudflap test case in the testsuite calls __wrap_calloc. In
> __wrap_calloc, __mf_state_1 is looked by __mf_get_state to see if
> it's in_malloc, reentrant or active. With emutls, HAVE_TLS is
> defined as 1 now. So __mf_state_1 has type of __thread. When emults
> tries to simulate TLS for __mf_state_1, it recursively calls
> __wrap_calloc in __emutls_get_address.

Interesting.

> To break the recursive loop, one solution is to force emutls to call
> the real calloc. [...]

If it were acceptable to change emutls on account of mudflap, this
sort of thing could work.  Other alternatives would include having
emutls define something in addition to HAVE_TLS that activates the
!HAVE_TLS implementation in libmudflap/mf-hooks3.c.

- FChE

Reply via email to