diff --git a/include/qemu/legacy_binary_info.h b/include/qemu/legacy_binary_info.h
index 2d42e852b7a..18886a05402 100644
--- a/include/qemu/legacy_binary_info.h
+++ b/include/qemu/legacy_binary_info.h
@@ -9,9 +9,17 @@
 #ifndef QEMU_LEGACY_BINARY_INFO_H
 #define QEMU_LEGACY_BINARY_INFO_H
 
+#include "qapi/qapi-types-common.h"
+
 void legacy_binary_info_init(const char *argv0);
 
 /* Return runtime equivalent of TARGET_LONG_BITS == 64 check */
 bool legacy_binary_is_64bit(void);
 
+/* Return runtime equivalent of TARGET_BIG_ENDIAN definition */
+bool legacy_binary_is_big_endian(void);
+
+/* Return endianness of legacy binary */
+EndianMode legacy_binary_endianness(void);
+
 #endif
diff --git a/legacy_binary_info.c b/legacy_binary_info.c
index be50d3f50ea..c9a8e99699e 100644
--- a/legacy_binary_info.c
+++ b/legacy_binary_info.c
@@ -9,10 +9,12 @@
 #include "qemu/osdep.h"
 #include "qemu/arch_info.h"
 #include "qemu/legacy_binary_info.h"
+#include "qapi/qapi-types-common.h"
 
 typedef struct LegacyBinaryInfo {
     const char *binary_name;
     QemuArchBit arch_bit;
+    EndianMode endianness;
     unsigned long_bits;
 } LegacyBinaryInfo;
 
@@ -21,146 +23,175 @@ static const LegacyBinaryInfo legacy_binary_infos[] = {
     {
         .binary_name = "qemu-system-aarch64",
         .arch_bit = QEMU_ARCH_BIT_ARM,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-alpha",
         .arch_bit = QEMU_ARCH_BIT_ALPHA,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-arm",
         .arch_bit = QEMU_ARCH_BIT_ARM,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-avr",
         .arch_bit = QEMU_ARCH_BIT_AVR,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-hppa",
         .arch_bit = QEMU_ARCH_BIT_HPPA,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-i386",
         .arch_bit = QEMU_ARCH_BIT_I386,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-loongarch64",
         .arch_bit = QEMU_ARCH_BIT_LOONGARCH,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-m68k",
         .arch_bit = QEMU_ARCH_BIT_M68K,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-microblaze",
         .arch_bit = QEMU_ARCH_BIT_MICROBLAZE,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-microblazeel",
         .arch_bit = QEMU_ARCH_BIT_MICROBLAZE,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-mips",
         .arch_bit = QEMU_ARCH_BIT_MIPS,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-mips64",
         .arch_bit = QEMU_ARCH_BIT_MIPS,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-mips64el",
         .arch_bit = QEMU_ARCH_BIT_MIPS,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-mipsel",
         .arch_bit = QEMU_ARCH_BIT_MIPS,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-or1k",
         .arch_bit = QEMU_ARCH_BIT_OPENRISC,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-ppc",
         .arch_bit = QEMU_ARCH_BIT_PPC,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-ppc64",
         .arch_bit = QEMU_ARCH_BIT_PPC,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-riscv32",
         .arch_bit = QEMU_ARCH_BIT_RISCV,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-riscv64",
         .arch_bit = QEMU_ARCH_BIT_RISCV,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-rx",
         .arch_bit = QEMU_ARCH_BIT_RX,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-s390x",
         .arch_bit = QEMU_ARCH_BIT_S390X,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-sh4",
         .arch_bit = QEMU_ARCH_BIT_SH4,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-sh4eb",
         .arch_bit = QEMU_ARCH_BIT_SH4,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-sparc",
         .arch_bit = QEMU_ARCH_BIT_SPARC,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-sparc64",
         .arch_bit = QEMU_ARCH_BIT_SPARC,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-tricore",
         .arch_bit = QEMU_ARCH_BIT_TRICORE,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-x86_64",
         .arch_bit = QEMU_ARCH_BIT_I386,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 64,
     },
     {
         .binary_name = "qemu-system-xtensa",
         .arch_bit = QEMU_ARCH_BIT_XTENSA,
+        .endianness = ENDIAN_MODE_LITTLE,
         .long_bits = 32,
     },
     {
         .binary_name = "qemu-system-xtensaeb",
         .arch_bit = QEMU_ARCH_BIT_XTENSA,
+        .endianness = ENDIAN_MODE_BIG,
         .long_bits = 32,
     },
 };
@@ -182,6 +213,7 @@ void legacy_binary_info_init(const char *argv0)
     for (size_t i = 0; i < ARRAY_SIZE(legacy_binary_infos); i++) {
         if (!strcmp(legacy_binary_infos[i].binary_name, binary_name)) {
             assert(legacy_binary_infos[i].long_bits);
+            assert(legacy_binary_infos[i].endianness != ENDIAN_MODE_UNSPECIFIED);
             current_index = i;
             return;
         }
@@ -195,3 +227,14 @@ bool legacy_binary_is_64bit(void)
     assert(current_index != -1);
     return legacy_binary_infos[current_index].long_bits == 64;
 }
+
+EndianMode legacy_binary_endianness(void)
+{
+    assert(current_index != -1);
+    return legacy_binary_infos[current_index].endianness;
+}
+
+bool legacy_binary_is_big_endian(void)
+{
+    return legacy_binary_endianness() == ENDIAN_MODE_BIG;
+}
