#include "inferior.h"
#include "elf-bfd.h"
+#include "elf/aarch64.h" /* for ELF flags. */
/* A Homogeneous Floating-Point or Short-Vector Aggregate may have at most
four members. */
gdb_assert (abfd != nullptr);
- asection *cap_relocs = bfd_get_section_by_name (abfd, "__cap_relocs");
+ int e_flags = elf_elfheader (abfd)->e_flags;
if (aarch64_debug)
- debug_printf ("%s: cap_relocs = %s\n", __func__,
- cap_relocs == nullptr? "not found" : "found");
+ debug_printf ("%s: e_flags = %x\n", __func__, e_flags);
- if (cap_relocs != nullptr)
+ if (e_flags & EF_AARCH64_CHERI_PURECAP)
return true;
- /* Assume regular non-capability symbol file. */
+ if (aarch64_debug)
+ debug_printf ("%s: e_flags doesn't contain EF_AARCH64_CHERI_PURECAP.\n",
+ __func__);
+
+ /* Use the LSB of e_entry for now. If the LSB is set, this means we have a
+ Morello pure capability binary. */
+ if (elf_elfheader (abfd)->e_entry & 1)
+ return true;
+
+ if (aarch64_debug)
+ debug_printf ("%s: e_entry's LSB is not set. Assuming AAPCS64 ABI.\n",
+ __func__);
+
+ /* Assume this is a Hybrid ABI ELF. */
return false;
}
have_capability = true;
}
}
+ else if (aarch64_current_abi_global == AARCH64_ABI_AAPCS64_CAP)
+ have_capability = true;
/* If there is already a candidate, use it. */
for (gdbarch_list *best_arch = gdbarch_list_lookup_by_info (arches, &info);
+2021-06-24 Luis Machado <luis.machado@arm.com>
+
+ * elf/aarch64.h (EF_AARCH64_CHERI_PURECAP): New constant.
+
2021-03-17 Luis Machado <luis.machado@arm.com>
* opcode/aarch64.h (enum map_type): Moved from opcodes/aarch64-dis.c.
#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
+/* AArch64-specific e_flags entries. */
+#define EF_AARCH64_CHERI_PURECAP 0x00010000
+
/* AArch64-specific values for st_other. */
#define STO_AARCH64_VARIANT_PCS 0x80 /* Symbol may follow different call
convention from the base PCS. */