Add ELF TLS support in new x64 backend.

This follows the implementation in the legacy x86 backend, including
hardcoded sequence that is compatible with what the linker expects. We
could potentially do better here, but it is likely not necessary.

Thanks to @bjorn3 for a bugfix to an earlier version of this.
This commit is contained in:
Chris Fallin
2020-12-13 18:05:38 -08:00
parent 8640025d8b
commit 0f563f786a
5 changed files with 100 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
test compile
set tls_model=elf_gd
target x86_64
feature "experimental_x64"
function u0:0(i32) -> i64 {
gv0 = symbol colocated tls u1:0
block0(v0: i32):
v1 = global_value.i64 gv0
return v1
}
; check: pushq %rbp
; nextln: movq %rsp, %rbp
; nextln: elf_tls_get_addr User { namespace: 1, index: 0 }
; nextln: movq %rbp, %rsp
; nextln: popq %rbp
; nextln: ret