aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-10-27 08:47:25 -0700
committerIan Lance Taylor <iant@golang.org>2021-10-27 08:47:25 -0700
commita6d3012b274f38b20e2a57162106f625746af6c6 (patch)
tree09ff8b13eb8ff7594c27dc8812efbf696dc97484 /libgcc/config
parentcd2fd5facb5e1882d3f338ed456ae9536f7c0593 (diff)
parent99b1021d21e5812ed01221d8fca8e8a32488a934 (diff)
downloadgcc-a6d3012b274f38b20e2a57162106f625746af6c6.zip
gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.gz
gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.bz2
Merge from trunk revision 99b1021d21e5812ed01221d8fca8e8a32488a934.
Diffstat (limited to 'libgcc/config')
-rw-r--r--libgcc/config/or1k/sfp-machine.h2
-rw-r--r--libgcc/config/rs6000/linux-unwind.h102
2 files changed, 89 insertions, 15 deletions
diff --git a/libgcc/config/or1k/sfp-machine.h b/libgcc/config/or1k/sfp-machine.h
index eebe5b0..162c6bc 100644
--- a/libgcc/config/or1k/sfp-machine.h
+++ b/libgcc/config/or1k/sfp-machine.h
@@ -85,7 +85,7 @@ do { \
#define __BYTE_ORDER __BIG_ENDIAN
-#define _FP_TININESS_AFTER_ROUNDING 1
+#define _FP_TININESS_AFTER_ROUNDING 0
/* Define ALIASNAME as a strong alias for NAME. */
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
diff --git a/libgcc/config/rs6000/linux-unwind.h b/libgcc/config/rs6000/linux-unwind.h
index acdc948..8deccc1d 100644
--- a/libgcc/config/rs6000/linux-unwind.h
+++ b/libgcc/config/rs6000/linux-unwind.h
@@ -94,6 +94,15 @@ struct gcc_ucontext
enum { SIGNAL_FRAMESIZE = 128 };
+struct rt_sigframe {
+ char gap[SIGNAL_FRAMESIZE];
+ struct gcc_ucontext uc;
+ unsigned long pad[2];
+ int tramp[6];
+ void *pinfo;
+ struct gcc_ucontext *puc;
+};
+
/* If PC is at a sigreturn trampoline, return a pointer to the
regs. Otherwise return NULL. */
@@ -136,14 +145,7 @@ get_regs (struct _Unwind_Context *context)
#endif
{
/* This works for 2.4.21 and later kernels. */
- struct rt_sigframe {
- char gap[SIGNAL_FRAMESIZE];
- struct gcc_ucontext uc;
- unsigned long pad[2];
- int tramp[6];
- void *pinfo;
- struct gcc_ucontext *puc;
- } *frame = (struct rt_sigframe *) context->cfa;
+ struct rt_sigframe *frame = (struct rt_sigframe *) context->cfa;
return frame->uc.regs;
}
}
@@ -154,6 +156,12 @@ get_regs (struct _Unwind_Context *context)
enum { SIGNAL_FRAMESIZE = 64 };
+struct rt_sigframe {
+ char gap[SIGNAL_FRAMESIZE + 16];
+ char siginfo[128];
+ struct gcc_ucontext uc;
+};
+
static struct gcc_regs *
get_regs (struct _Unwind_Context *context)
{
@@ -176,11 +184,7 @@ get_regs (struct _Unwind_Context *context)
}
else if (pc[0] == 0x38006666 || pc[0] == 0x380000AC)
{
- struct rt_sigframe {
- char gap[SIGNAL_FRAMESIZE + 16];
- char siginfo[128];
- struct gcc_ucontext uc;
- } *frame = (struct rt_sigframe *) context->cfa;
+ struct rt_sigframe *frame = (struct rt_sigframe *) context->cfa;
return frame->uc.regs;
}
return NULL;
@@ -203,7 +207,7 @@ ppc_fallback_frame_state (struct _Unwind_Context *context,
int i;
if (regs == NULL)
- return _URC_END_OF_STACK;
+ return _URC_NORMAL_STOP;
new_cfa = regs->gpr[__LIBGCC_STACK_POINTER_REGNUM__];
fs->regs.cfa_how = CFA_REG_OFFSET;
@@ -352,3 +356,73 @@ frob_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs ATT
}
#endif
}
+
+#define MD_BACKCHAIN_FALLBACK ppc_backchain_fallback
+
+struct trace_arg
+{
+ /* Stores the list of addresses. */
+ void **array;
+ struct unwind_link *unwind_link;
+ _Unwind_Word cfa;
+ /* Number of addresses currently stored. */
+ int count;
+ /* Maximum number of addresses. */
+ int size;
+};
+
+/* This is the stack layout we see with every stack frame.
+ Note that every routine is required by the ABI to lay out the stack
+ like this.
+
+ +----------------+ +-----------------+
+ %r1 -> | previous frame--------> | previous frame--->... --> NULL
+ | | | |
+ | cr save | | cr save |
+ | | | |
+ | (unused) | | lr save |
+ +----------------+ +-----------------+
+
+ The CR save is only present on 64-bit ABIs.
+*/
+struct frame_layout
+{
+ struct frame_layout *backchain;
+#ifdef __powerpc64__
+ long int cr_save;
+#endif
+ void *lr_save;
+};
+
+
+void ppc_backchain_fallback (struct _Unwind_Context *context, void *a)
+{
+ struct frame_layout *current;
+ struct trace_arg *arg = a;
+ int count;
+
+ /* Get the last address computed and start with the next. */
+ current = context->cfa;
+ current = current->backchain;
+
+ for (count = arg->count; current != NULL; current = current->backchain)
+ {
+ arg->array[count] = current->lr_save;
+
+ /* Check if the symbol is the signal trampoline and get the interrupted
+ symbol address from the trampoline saved area. */
+ context->ra = current->lr_save;
+ if (current->lr_save && get_regs (context))
+ {
+ struct rt_sigframe *sigframe = (struct rt_sigframe *) current;
+ if (count + 1 == arg->size)
+ break;
+ arg->array[++count] = (void *) sigframe->uc.rsave.nip;
+ current = (void *) sigframe->uc.rsave.gpr[1];
+ }
+ if (count++ >= arg->size)
+ break;
+ }
+
+ arg->count = count-1;
+}