summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dwarflint.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dwarflint.c b/src/dwarflint.c
index 29238551..9ad978f1 100644
--- a/src/dwarflint.c
+++ b/src/dwarflint.c
@@ -1030,6 +1030,13 @@ elf_file_init (struct elf_file *file, Elf *elf)
file->addr_64 = file->ehdr.e_ident[EI_CLASS] == ELFCLASS64;
+ /* Taken from dwarf_begin_elf.c. */
+ if ((BYTE_ORDER == LITTLE_ENDIAN
+ && file->ehdr.e_ident[EI_DATA] == ELFDATA2MSB)
+ || (BYTE_ORDER == BIG_ENDIAN
+ && file->ehdr.e_ident[EI_DATA] == ELFDATA2LSB))
+ file->other_byte_order = true;
+
struct secinfo
{
const char *name;