This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix eh on tru64 [Re: libjava status on Tru64 UNIX V5.1]
- From: Richard Henderson <rth at redhat dot com>
- To: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Mar 2002 18:14:25 -0800
- Subject: fix eh on tru64 [Re: libjava status on Tru64 UNIX V5.1]
- References: <15512.61612.378681.513303@xayide.TechFak.Uni-Bielefeld.DE> <20020320130516.E5229@redhat.com> <15514.18300.655077.985398@xayide.TechFak.Uni-Bielefeld.DE> <20020321130655.B6065@redhat.com> <15519.12421.582078.962629@xayide.TechFak.Uni-Bielefeld.DE> <15519.41783.527457.292259@xayide.TechFak.Uni-Bielefeld.DE>
On Mon, Mar 25, 2002 at 11:22:47PM +0100, Rainer Orth wrote:
> As I had found out before, $gp is mangled after the return from
> __cxa_throw. In both cases, $gp is restored from the stack frame after
> that call, but only the 3.0.5 compiler stores it there immediately after
> the end of the prologue, so clearly in 3.1 we get garbage and the next
> function call crashes as observed.
Ah, ok. Broke first by changing to use get_hard_reg_initial_value,
but secondarily by other $gp changes in the back end (wrt invariance
of the pic register).
This should fix it. While it looks good on paper, I'll wait for an
ack before committing it.
r~
* toplev.c (rest_of_compilation): Delay emit_initial_value_sets
until after eh landing pad generation.
* config/alpha/alpha.c (alpha_gp_save_rtx): Use gen_mem_addressof.
* config/alpha/alpha.md (exception_receiver_2): Only accept MEMs.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.574.2.4
diff -c -p -d -r1.574.2.4 toplev.c
*** toplev.c 2002/03/21 23:12:24 1.574.2.4
--- toplev.c 2002/03/26 02:06:35
*************** rest_of_compilation (decl)
*** 2540,2546 ****
carry magic hard reg data throughout the function. */
rtx_equal_function_value_matters = 0;
purge_hard_subreg_sets (get_insns ());
- emit_initial_value_sets ();
/* Don't return yet if -Wreturn-type; we need to do cleanup_cfg. */
if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
--- 2540,2545 ----
*************** rest_of_compilation (decl)
*** 2571,2576 ****
--- 2570,2579 ----
close_dump_file (DFI_eh, print_rtl, get_insns ());
timevar_pop (TV_JUMP);
}
+
+ /* Delay emitting hard_reg_initial_value sets until after EH landing pad
+ generation, which might create new sets. */
+ emit_initial_value_sets ();
#ifdef FINALIZE_PIC
/* If we are doing position-independent code generation, now
Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.233.2.3
diff -c -p -d -r1.233.2.3 alpha.c
*** alpha.c 2002/03/18 03:03:51 1.233.2.3
--- alpha.c 2002/03/26 02:06:35
*************** alpha_return_addr (count, frame)
*** 5004,5010 ****
rtx
alpha_gp_save_rtx ()
{
! return get_hard_reg_initial_val (DImode, 29);
}
static int
--- 5004,5010 ----
rtx
alpha_gp_save_rtx ()
{
! return gen_mem_addressof (get_hard_reg_initial_val (DImode, 29), NULL_TREE);
}
static int
Index: config/alpha/alpha.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.md,v
retrieving revision 1.182.2.1
diff -c -p -d -r1.182.2.1 alpha.md
*** alpha.md 2002/02/27 02:20:00 1.182.2.1
--- alpha.md 2002/03/26 02:06:35
*************** fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi
*** 6706,6718 ****
(set_attr "type" "multi")])
(define_insn "*exception_receiver_2"
! [(unspec_volatile [(match_operand:DI 0 "nonimmediate_operand" "r,m")]
! UNSPECV_EHR)]
"TARGET_LD_BUGGY_LDGP"
! "@
! bis $31,%0,$29
! ldq $29,%0"
! [(set_attr "type" "ilog,ild")])
(define_expand "nonlocal_goto_receiver"
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
--- 6706,6715 ----
(set_attr "type" "multi")])
(define_insn "*exception_receiver_2"
! [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
"TARGET_LD_BUGGY_LDGP"
! "ldq $29,%0"
! [(set_attr "type" "ild")])
(define_expand "nonlocal_goto_receiver"
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)