public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: Add PowerPC support to gdb.dwarf2/frame-inlined-in-outer-frame.exp
@ 2021-11-29 21:43 Carl Love
  2021-11-29 23:22 ` will schmidt
  2021-12-04  0:38 ` [PATCH ver2] " Carl Love
  0 siblings, 2 replies; 14+ messages in thread
From: Carl Love @ 2021-11-29 21:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: cel, Will Schmidt, Rogerio Alves

GDB maintainers:

The following patch adds the needed Powerpc support to the
gdb.dwarf2/frame-inlined-in-outer-frame test.  The patch adds the
needed Power instructions to the exit_0 macro.  It also adds the needed
support for PowerPC Elfv1 or Elfv2 if the architecture is powerpc64.

The patch has been tested on PowerPC LE and BE as well as X86_64 with
no failures.

Please let me know if this patch is acceptable for mainline.  Thanks.

              Carl 
--------------------------------------------
gdb: Add PowerPC support to gdb.dwarf2/frame-inlined-in-outer-frame.exp

The test does not run on PowerPC BE or LE as it is missing an #elif
defined for PowerPC to setup the exit_0 macro.  This patch addes the needed
macro definition.  It also setup the assembly code to use the elfv1 if
running on a PowerPC BE system and elfv2 if running on a PowerPC LE system.

The patch has been successfully tested on both PowerPC BE, Powerpc LE and
X86_64 with no regressions.
---
 .../gdb.dwarf2/frame-inlined-in-outer-frame.S | 34 +++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
index 9fb6e7b7164..ecb344f4426 100644
--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
+++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
@@ -65,6 +65,16 @@
 	swi 0x0
 .endm
 
+#elif defined __powerpc64__
+
+# define RETURN_ADDRESS_REGNO 65
+
+.macro exit_0
+	li 0, __NR_exit  /* r0 - contains system call number */
+	li 3, 0          /* r3 - contains first argument for sys call */
+	sc
+.endm
+
 #else
 # error "Unsupported architecture"
 #endif
@@ -90,8 +100,28 @@
    16 }
 */
 
-.global _start
-_start:
+# if defined __powerpc64__
+	#if _CALL_ELF == 2
+		.abiversion 2   /* Tell gdb what ELF version to use. */
+		.global _start
+		_start:
+	#else
+		.abiversion 1     /* Tell gdb what ELF version to use. */
+		.align 2
+		.global _start
+		.section ".opd", "aw"
+		.align 3
+		_start:
+		.quad ._start,.TOC.@tocbase,0
+		.previous
+		.type ._start,@function
+		._start:
+	#endif
+#else
+	.global _start
+	_start:
+#endif
+
 .cfi_startproc
 
 /* State that the return address for this frame is undefined. */
-- 
2.30.2



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

end of thread, other threads:[~2021-12-09 17:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 21:43 [PATCH] gdb: Add PowerPC support to gdb.dwarf2/frame-inlined-in-outer-frame.exp Carl Love
2021-11-29 23:22 ` will schmidt
2021-12-04  0:38 ` [PATCH ver2] " Carl Love
2021-12-04  2:13   ` Simon Marchi
2021-12-06  5:56     ` will schmidt
2021-12-06 16:37     ` [PATCH ver3] " Carl Love
2021-12-06 16:43       ` Simon Marchi
2021-12-06 18:06         ` Carl Love
2021-12-06 18:50           ` Simon Marchi
2021-12-06 19:35             ` Carl Love
2021-12-06 19:38               ` Simon Marchi
2021-12-07  8:37             ` Ulrich Weigand
     [not found]             ` <OF8B2BBF19.16E7F948-ONC12587A4.002F3132-C12587A4.002F617F@us.ibm.com>
2021-12-08 20:49               ` Carl Love
2021-12-09 17:30                 ` 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).