From: Will Schmidt Date: Wed, 18 Aug 2021 16:43:45 +0000 (-0500) Subject: [gdb] [rs6000] Add ppc64*_gnu_triplet_regexp methods. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc0df0fa47561817ba263f4de13525d998bd5903;p=binutils-gdb.git [gdb] [rs6000] Add ppc64*_gnu_triplet_regexp methods. Add methods to set the target triplet so we can find the proper gcc when our gcc is named of the form powerpc64{le}--gcc or ppc64{le}--gcc. --- diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index e62f45a35d8..4be75d1035e 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1973,6 +1973,30 @@ ppc_floatformat_for_type (struct gdbarch *gdbarch, return default_floatformat_for_type (gdbarch, name, len); } +/* Specify the powerpc64le target triplet. + This can be variations of + ppc64le-{distro}-linux-gcc + and + powerpc64le-{distro}-linux-gcc. */ + +static const char * +ppc64le_gnu_triplet_regexp (struct gdbarch *gdbarch) +{ + return "p(ower)?pc64le"; +} + +/* Specify the powerpc64 target triplet. + This can be variations of + ppc64-{distro}-linux-gcc + and + powerpc64-{distro}-linux-gcc. */ + +static const char * +ppc64_gnu_triplet_regexp (struct gdbarch *gdbarch) +{ + return "p(ower)?pc64"; +} + static void ppc_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -2103,6 +2127,11 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle"); else set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc"); + /* Set compiler triplet. */ + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) + set_gdbarch_gnu_triplet_regexp (gdbarch, ppc64le_gnu_triplet_regexp); + else + set_gdbarch_gnu_triplet_regexp (gdbarch, ppc64_gnu_triplet_regexp); } set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);