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

@@ -3904,6 +3904,17 @@ fn test_x64_emit() {
let trap_code = TrapCode::UnreachableCodeReached;
insns.push((Inst::Ud2 { trap_code }, "0F0B", "ud2 unreachable"));
insns.push((
Inst::ElfTlsGetAddr {
symbol: ExternalName::User {
namespace: 0,
index: 0,
},
},
"66488D3D00000000666648E800000000",
"elf_tls_get_addr User { namespace: 0, index: 0 }",
));
// ========================================================
// Actually run the tests!
let mut flag_builder = settings::builder();