bjorn3 opened issue #3130:
Feature
See issue title.
Benefit
Required by cg_clif's jit mode.
Implementation
Give every defined jit tls variable a globally unique id using a global atomic counter. Next define a single native TLS variable inside
cranelift_jit
. This TLS variable points to a vec of pointers indexed by the previously mentioned globally unique id. Require the elf_tls_gd tls model and forward__tls_get_addr
to a function of cranelift_jit that looks up the tls variable address using the native tls variable and initializes the tls variable if necessary.This implementation method doesn't allow importing native tls variables, supporting native tls requires support from libc and rust never exports tls variables directly anyway.
thread_local!
wraps it in a function call.Alternatives
Add a bunch of special cases in cg_clif to use a different tls declaration method when in jit mode and implement this proposal in cg_clif itself. This increases complexity and reduces reusability.
akirilov-arm labeled issue #3130:
Feature
See issue title.
Benefit
Required by cg_clif's jit mode.
Implementation
Give every defined jit tls variable a globally unique id using a global atomic counter. Next define a single native TLS variable inside
cranelift_jit
. This TLS variable points to a vec of pointers indexed by the previously mentioned globally unique id. Require the elf_tls_gd tls model and forward__tls_get_addr
to a function of cranelift_jit that looks up the tls variable address using the native tls variable and initializes the tls variable if necessary.This implementation method doesn't allow importing native tls variables, supporting native tls requires support from libc and rust never exports tls variables directly anyway.
thread_local!
wraps it in a function call.Alternatives
Add a bunch of special cases in cg_clif to use a different tls declaration method when in jit mode and implement this proposal in cg_clif itself. This increases complexity and reduces reusability.
Last updated: Dec 23 2024 at 12:05 UTC