aarch64: Implement TLS ELF GD Relocations

Implement the `TlsValue` opcode in the aarch64 backend for ELF_GD.

This is a little bit unusual as the default TLS mechanism for aarch64 is TLS Descriptors in other compilers.
However currently we only recognize elf_gd so lets start with that as a TLS implementation.
This commit is contained in:
Afonso Bordado
2021-06-22 20:18:26 +01:00
parent 4a6594c514
commit b8ad99e435
6 changed files with 129 additions and 3 deletions

View File

@@ -618,6 +618,30 @@ impl ObjectModule {
32,
)
}
Reloc::Aarch64TlsGdAdrPage21 => {
assert_eq!(
self.object.format(),
object::BinaryFormat::Elf,
"Aarch64TlsGdAdrPrel21 is not supported for this file format"
);
(
RelocationKind::Elf(object::elf::R_AARCH64_TLSGD_ADR_PAGE21),
RelocationEncoding::Generic,
21,
)
}
Reloc::Aarch64TlsGdAddLo12Nc => {
assert_eq!(
self.object.format(),
object::BinaryFormat::Elf,
"Aarch64TlsGdAddLo12Nc is not supported for this file format"
);
(
RelocationKind::Elf(object::elf::R_AARCH64_TLSGD_ADD_LO12_NC),
RelocationEncoding::Generic,
12,
)
}
// FIXME
reloc => unimplemented!("{:?}", reloc),
};