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:
19
cranelift/filetests/filetests/isa/x64/tls_elf.clif
Normal file
19
cranelift/filetests/filetests/isa/x64/tls_elf.clif
Normal 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
|
||||
Reference in New Issue
Block a user