From: "REIX, Tony" <tony.reix@atos.net>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "SARTER, MATTHIEU (ext)" <matthieu.sarter.external@atos.net>,
"David Edelsohn" <edelsohn@us.ibm.com>
Subject: [PATCH,AIX] Enable Stack Unwinding on AIX
Date: Mon, 15 May 2017 15:49:00 -0000 [thread overview]
Message-ID: <B37989F2852398498001550C29155BE5CD3587@FRCRPVV9EX3MSX.ww931.my-it-solutions.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
Description:
* This patch enables the stack unwinding on AIX.
Tests:
* Fedora25/x86_64 + GCC v7.1.0 : Configure/Build: SUCCESS
- build made by means of a .spec file based on Fedora gcc-7.0.1-0.12 .spec file
../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
ChangeLog:
* libgcc/config/rs6000/aix-unwind.h : Implements stack unwinding on AIX.
Regards,
Tony Reix
Bull - ATOS
IBM Coop Architect & Technical Leader
Office : +33 (0) 4 76 29 72 67
1 rue de Provence - 38432 Échirolles - France
www.atos.net
[-- Attachment #2: patchStackUnwindingOnAIX.txt --]
[-- Type: text/plain, Size: 2441 bytes --]
--- ./libgcc/config/rs6000/aix-unwind.h 2017-01-02 01:20:05 -0600
+++ ./libgcc/config/rs6000/aix-unwind.h 2017-04-28 10:03:16 -0500
@@ -64,7 +64,8 @@
#endif
/* Now on to MD_FALLBACK_FRAME_STATE_FOR.
- 32bit AIX 5.2, 5.3 and 7.1 only at this stage. */
+ 32bit AIX 5.2, 5.3, 6.1, 7.X and
+ 64bit AIX 6.1, 7.X only at this stage. */
#include <stdlib.h>
#include <stddef.h>
@@ -73,10 +74,10 @@
#ifdef __64BIT__
-/* 64bit fallback not implemented yet, so MD_FALLBACK_FRAME_STATE_FOR not
- defined. Arrange just for the code below to compile. */
typedef struct __context64 mstate_t;
+#define MD_FALLBACK_FRAME_STATE_FOR ppc_aix_fallback_frame_state
+
#else
typedef struct mstsave mstate_t;
@@ -128,10 +129,26 @@ ucontext_for (struct _Unwind_Context *co
{
const unsigned int * ra = context->ra;
- /* AIX 5.2, 5.3 and 7.1, threaded or not, share common patterns
+ /* AIX 5.2, 5.3, 6.1 and 7.X, threaded or not, share common patterns
and feature variants depending on the configured kernel (unix_mp
or unix_64). */
+#ifdef __64BIT__
+ if (*(ra - 5) == 0x4c00012c /* isync */
+ && *(ra - 4) == 0xe8ec0000 /* ld r7,0(r12) */
+ && *(ra - 3) == 0xe84c0008 /* ld r2,8(r12) */
+ && *(ra - 2) == 0x7ce903a6 /* mtctr r7 */
+ && *(ra - 1) == 0x4e800421 /* bctrl */
+ && *(ra - 0) == 0x7de27b78) /* mr r2,r15 <-- context->ra */
+ {
+ /* unix_64 */
+ if (*(ra - 6) == 0x7d000164) /* mtmsrd r8 */
+ {
+ /* AIX 6.1, 7.1 and 7.2 */
+ return (ucontext_t *)(context->cfa + 0x70);
+ }
+ }
+#else
if (*(ra - 5) == 0x4c00012c /* isync */
&& *(ra - 4) == 0x80ec0000 /* lwz r7,0(r12) */
&& *(ra - 3) == 0x804c0004 /* lwz r2,4(r12) */
@@ -152,10 +169,14 @@ ucontext_for (struct _Unwind_Context *co
case 0x835a0570: /* lwz r26,1392(r26) */
return (ucontext_t *)(context->cfa + 0x40);
- /* AIX 7.1 */
+ /* AIX 6.1 and 7.1 */
case 0x2c1a0000: /* cmpwi r26,0 */
return (ucontext_t *)(context->cfa + 0x40);
-
+
+ /* AIX 7.2 */
+ case 0x3800000a: /* li r0,A */
+ return (ucontext_t *)(context->cfa + 0x40);
+
default:
return 0;
}
@@ -174,7 +195,7 @@ ucontext_for (struct _Unwind_Context *co
return &frame->ucontext;
}
}
-
+#endif
return 0;
}
next reply other threads:[~2017-05-15 14:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-15 15:49 REIX, Tony [this message]
2017-05-15 20:31 David Edelsohn
2017-05-16 13:53 ` REIX, Tony
2017-05-16 14:27 ` [PATCH,AIX] " David Edelsohn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B37989F2852398498001550C29155BE5CD3587@FRCRPVV9EX3MSX.ww931.my-it-solutions.net \
--to=tony.reix@atos.net \
--cc=edelsohn@us.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=matthieu.sarter.external@atos.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).