summaryrefslogtreecommitdiff
path: root/view
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2025-05-28 08:33:30 -0400
committerBrandon Miller <brandon@vector35.com>2025-05-28 08:33:30 -0400
commit6e4c00a80fa86bcfefba9630a1ea8e2a47bef2de (patch)
tree94f891149263fe089d747c4baba7d20a80a7750b /view
parentb13d50bac18c341b98e6a3002ac9f17f6c8a8df4 (diff)
Support for Linux x86-64 x32 ABI
Diffstat (limited to 'view')
-rw-r--r--view/elf/elfview.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index 6d19bc5f..bb193495 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -54,7 +54,7 @@ ElfView::ElfView(BinaryView* data, bool parseOnly): BinaryView("ELF", data->GetF
CreateLogger("BinaryView");
m_logger = CreateLogger("BinaryView.ElfView");
m_elf32 = m_ident.fileClass == 1;
- m_addressSize = (m_ident.fileClass == 1) ? 4 : 8;
+ m_addressSize = (m_ident.fileClass == 1 || (m_plat && m_plat->GetName() == "linux-32")) ? 4 : 8;
m_endian = endian;
m_relocatable = m_commonHeader.type == ET_DYN || m_commonHeader.type == ET_REL;
m_objectFile = m_commonHeader.type == ET_REL;
@@ -2874,16 +2874,6 @@ uint64_t ElfViewType::ParseHeaders(BinaryView* data, ElfIdent& ident, ElfCommonH
commonHeader.arch = reader.Read16();
commonHeader.version = reader.Read32();
- // Promote the file class to 64-bit
- // TODO potentially add a setting to allow the user to override header interpretation
- if ((commonHeader.type == ET_EXEC) && (commonHeader.arch == EM_X86_64) && (ident.fileClass == 1))
- {
- ident.fileClass = 2;
- m_logger->LogWarn(
- "Executable file claims to be 32-bit but specifies a 64-bit architecture. It is likely malformed or "
- "malicious. Treating it as 64-bit.");
- }
-
// parse Elf64Header
if (ident.fileClass == 1) // 32-bit ELF
{