}
 
 static const char *
-pformat (const struct floatformat **format)
+pformat (struct gdbarch *gdbarch, const struct floatformat **format)
 {
   if (format == NULL)
     return "(null)";
-  else
-    /* Just print out one of them - this is only for diagnostics.  */
-    return format[0]->name;
+
+  int format_index = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE ? 1 : 0;
+  return format[format_index]->name;
 }
 
 static const char *
 
     name="bfloat16_format",
     postdefault="floatformats_bfloat16",
     invalid=True,
-    printer="pformat (gdbarch->bfloat16_format)",
+    printer="pformat (gdbarch, gdbarch->bfloat16_format)",
 )
 
 Value(
     name="half_format",
     postdefault="floatformats_ieee_half",
     invalid=True,
-    printer="pformat (gdbarch->half_format)",
+    printer="pformat (gdbarch, gdbarch->half_format)",
 )
 
 Value(
     name="float_format",
     postdefault="floatformats_ieee_single",
     invalid=True,
-    printer="pformat (gdbarch->float_format)",
+    printer="pformat (gdbarch, gdbarch->float_format)",
 )
 
 Value(
     name="double_format",
     postdefault="floatformats_ieee_double",
     invalid=True,
-    printer="pformat (gdbarch->double_format)",
+    printer="pformat (gdbarch, gdbarch->double_format)",
 )
 
 Value(
     name="long_double_format",
     postdefault="floatformats_ieee_double",
     invalid=True,
-    printer="pformat (gdbarch->long_double_format)",
+    printer="pformat (gdbarch, gdbarch->long_double_format)",
 )
 
 Value(
 
                       plongest (gdbarch->bfloat16_bit));
   gdb_printf (file,
                       "gdbarch_dump: bfloat16_format = %s\n",
-                      pformat (gdbarch->bfloat16_format));
+                      pformat (gdbarch, gdbarch->bfloat16_format));
   gdb_printf (file,
                       "gdbarch_dump: half_bit = %s\n",
                       plongest (gdbarch->half_bit));
   gdb_printf (file,
                       "gdbarch_dump: half_format = %s\n",
-                      pformat (gdbarch->half_format));
+                      pformat (gdbarch, gdbarch->half_format));
   gdb_printf (file,
                       "gdbarch_dump: float_bit = %s\n",
                       plongest (gdbarch->float_bit));
   gdb_printf (file,
                       "gdbarch_dump: float_format = %s\n",
-                      pformat (gdbarch->float_format));
+                      pformat (gdbarch, gdbarch->float_format));
   gdb_printf (file,
                       "gdbarch_dump: double_bit = %s\n",
                       plongest (gdbarch->double_bit));
   gdb_printf (file,
                       "gdbarch_dump: double_format = %s\n",
-                      pformat (gdbarch->double_format));
+                      pformat (gdbarch, gdbarch->double_format));
   gdb_printf (file,
                       "gdbarch_dump: long_double_bit = %s\n",
                       plongest (gdbarch->long_double_bit));
   gdb_printf (file,
                       "gdbarch_dump: long_double_format = %s\n",
-                      pformat (gdbarch->long_double_format));
+                      pformat (gdbarch, gdbarch->long_double_format));
   gdb_printf (file,
                       "gdbarch_dump: wchar_bit = %s\n",
                       plongest (gdbarch->wchar_bit));