@@ -47,6 +47,7 @@
#include "i386-tdep.h"
#include "i387-tdep.h"
#include "x86-xstate.h"
+#include "amd64-tdep.h"
#include "record.h"
#include "record-full.h"
@@ -8568,6 +8578,18 @@ i386_gdbarch_init (struct gdbarch_info info, struct
gdbarch_list *arches)
info.tdep_info = tdesc_data;
gdbarch_init_osabi (info, gdbarch);
+ /* If we're a 64-bit arch but no osabi to fill in 64-bit values,
+ do so now. */
+ if (info.osabi == GDB_OSABI_UNKNOWN
+ && info.bfd_arch_info->bits_per_address == 64
+ && gdbarch_ptr_bit (gdbarch) == 32)
+ {
+ if (strcmp (info.bfd_arch_info->printable_name, "i386:x64-32") == 0)
+ amd64_x32_init_abi (info, gdbarch);
+ else
+ amd64_init_abi (info, gdbarch);
+ }
+
if (!i386_validate_tdesc_p (tdep, tdesc_data))
{
tdesc_data_cleanup (tdesc_data);
but that was awhile ago (and I may have grabbed the wrong one, but I hope
you get the idea). I had some problems with it so I abandoned it.
If people think this is a better way to go than the patch below
I'm happy to give it another go.
Anyways this is RFC.
2016-11-07 Doug Evans <dje@google.com>
* amd64-tdep.c (_initialize_amd64_tdep): Register "bare-metal"
osabi handlers.
* configure.tgt (*-*-elf): Make default osabi "bare-metal".
* defs.h (gdb_osabi): New enum value GDB_OSABI_BARE_METAL.
* i386-tdep.c (i386_init_abi): New function.
(): Register "bare-metal" osabi.
* osabi.c (gdb_osabi_names): Add "bare-metal".
@@ -3209,6 +3209,11 @@ void _initialize_amd64_tdep (void);
void
_initialize_amd64_tdep (void)
{
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
+ GDB_OSABI_BARE_METAL, amd64_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32,
+ GDB_OSABI_BARE_METAL, amd64_x32_init_abi);
+
initialize_tdesc_amd64 ();
initialize_tdesc_amd64_avx ();
initialize_tdesc_amd64_mpx ();
@@ -719,6 +719,7 @@ esac
# map target onto default OS ABI
case "${targ}" in
+*-*-elf*) gdb_osabi=GDB_OSABI_BARE_METAL ;;
*-*-freebsd* | *-*-kfreebsd*-gnu)
gdb_osabi=GDB_OSABI_FREEBSD_ELF ;;
*-*-linux* | *-*-uclinux*)
@@ -607,6 +607,7 @@ enum gdb_osabi
GDB_OSABI_LYNXOS178,
GDB_OSABI_NEWLIB,
GDB_OSABI_SDE,
+ GDB_OSABI_BARE_METAL,
GDB_OSABI_INVALID /* keep this last */
};
@@ -4412,6 +4412,15 @@ i386_gnu_triplet_regexp (struct gdbarch *gdbarch)
+/* A nop init_abi routine needed for i386-elf configs.
+ There's nothing to do, but gdbarch_init_osabi still needs to find an
entry
+ for bfd_mach_i386_i386 + GDB_OSABI_BARE_METAL. */
+
+static void
+i386_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+}
+
/* Generic ELF. */
void
@@ -9025,6 +9034,9 @@ Show Intel Memory Protection Extensions specific
variables."),
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
i386_go32_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_i386_i386,
+ GDB_OSABI_BARE_METAL, i386_init_abi);
+
/* Initialize the i386-specific register groups. */
i386_init_reggroups ();
@@ -83,6 +83,7 @@ static const struct osabi_names gdb_osabi_names[] =
{ "LynxOS178", NULL },
{ "Newlib", NULL },
{ "SDE", NULL },
+ { "bare-metal", NULL },
{ "<invalid>", NULL }
};