public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Add ppc64*_gnu_triplet_regexp methods.
@ 2021-07-27 15:36 will schmidt
  2021-07-28 22:04 ` Lancelot SIX
  2021-07-29 19:42 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: will schmidt @ 2021-07-27 15:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand, Alan Modra, rogerio, Carl E. Love

[PATCH, rs6000] Add ppc64*_gnu_triplet_regexp methods.
    
Hi,
  Add methods to set the target triplet so we can
find the proper gcc when our gcc is named of
the form powerpc64{le}-<foo>-gcc or ppc64{le}-<foo>-gcc.

This helps allow the gdb-compile support to function
for the powerpc targets.

OK for trunk?
Thanks
-Will

gdb/Changelog:
yyyy-mm-dd  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* gdb/ppc-linux-tdep.c (ppc64le_gnu_triplet_regexp): New
	function to set triplet.
	(ppc64_gnu_triplet_regexp): Same.
	(ppc_linux_init_abi): Conditionally call to set the
	ppc64 or ppc64le triplets.

diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 1e94922f25a..de3e026a72b 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1971,10 +1971,34 @@ 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)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -2101,10 +2125,15 @@ ppc_linux_init_abi (struct gdbarch_info info,
       /* BFD target for core files.  */
       if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
 	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);
   set_gdbarch_iterate_over_regset_sections (gdbarch,
 					    ppc_linux_iterate_over_regset_sections);


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-16 12:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 15:36 [PATCH, rs6000] Add ppc64*_gnu_triplet_regexp methods will schmidt
2021-07-28 22:04 ` Lancelot SIX
2021-07-29 19:42 ` Tom Tromey
2021-08-03 18:35   ` will schmidt
2021-08-05 20:43   ` [PATCH, rs6000] [V2] " will schmidt
2021-08-16 12:14     ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).