From 770e9c0c75a943cd4d47ba3cb3be936d09a6c86f Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Sat, 24 Jan 2026 01:24:25 -0500 Subject: Implement DTPOFF64 and DTPMOD64 relocations. Finally closes #5463. --- view/elf/elfview.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'view/elf/elfview.cpp') diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index 2df24a5a..58e82efc 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -1480,6 +1480,13 @@ bool ElfView::Init() else if(reloc.relocType == R_ARM_TLS_DTPMOD32) tlsModuleStarts.push_back(reloc.offset); } + else if (m_arch && (m_arch->GetName() == "x86_64")) + { + if (reloc.relocType == R_X86_64_DTPOFF64) + tlsOffsets.push_back(reloc.offset); + else if (reloc.relocType == R_X86_64_DTPMOD64) + tlsModuleStarts.push_back(reloc.offset); + } } if (relocHandler->GetRelocationInfo(this, m_arch, m_relocationInfo)) @@ -2496,10 +2503,13 @@ bool ElfView::Init() } // Add type, data variables for TLS entries + size_t tlsModuleEntrySize = 4; + if (m_arch && (m_arch->GetAddressSize() == 8)) + tlsModuleEntrySize = 8; for (auto offset : tlsModuleStarts) { /* All module ID's are set to 0. */ - DefineDataVariable(offset, Type::IntegerType(4, false)->WithConfidence(BN_FULL_CONFIDENCE)); + DefineDataVariable(offset, Type::IntegerType(tlsModuleEntrySize, false)->WithConfidence(BN_FULL_CONFIDENCE)); } for (auto offset : tlsOffsets) { -- cgit v1.3.1