summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch')
-rw-r--r--recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch158
1 files changed, 158 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch b/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch
new file mode 100644
index 00000000..d6549cad
--- /dev/null
+++ b/recipes-devtools/gcc/files/0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch
@@ -0,0 +1,158 @@
1From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
2Subject: [PATCH 1/8] [Patch, microblaze]: Enable DWARF exception handling
3 support.
4
5Changelog
6
72013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 David Holsgrove <david.holsgrove@xilinx.com>
9
10 * common/config/microblaze/microblaze-common.c: Remove
11 TARGET_EXCEPT_UNWIND_INFO definition.
12 * config/microblaze/microblaze-protos.h: Add
13 microblaze_eh_return prototype.
14 * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
15 microblaze_expand_epilogue, microblaze_return_addr): Handle
16 calls_eh_return
17 (microblaze_eh_return): New function.
18 * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
19 EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
20 ASM_PREFERRED_EH_DATA_FORMAT
21 * gcc/config/microblaze/microblaze.md: Define eh_return pattern.
22
23Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
24Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
25Upstream-Status: Pending
26
27diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c
28index 07a71fb..6c25a76 100644
29--- a/gcc/common/config/microblaze/microblaze-common.c
30+++ b/gcc/common/config/microblaze/microblaze-common.c
31@@ -37,7 +37,4 @@ static const struct default_options microblaze_option_optimization_table[] =
32 #undef TARGET_OPTION_OPTIMIZATION_TABLE
33 #define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
34
35-#undef TARGET_EXCEPT_UNWIND_INFO
36-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
37-
38 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
39diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
40index 34be76f..201390b 100644
41--- a/gcc/config/microblaze/microblaze-protos.h
42+++ b/gcc/config/microblaze/microblaze-protos.h
43@@ -54,6 +54,7 @@ extern bool microblaze_tls_referenced_p (rtx);
44 extern int symbol_mentioned_p (rtx);
45 extern int label_mentioned_p (rtx);
46 extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx);
47+extern void microblaze_eh_return (rtx op0);
48 #endif /* RTX_CODE */
49
50 /* Declare functions in microblaze-c.c. */
51diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
52index c121c2b..5f4bc60 100644
53--- a/gcc/config/microblaze/microblaze.c
54+++ b/gcc/config/microblaze/microblaze.c
55@@ -1896,6 +1896,11 @@ microblaze_must_save_register (int regno)
56 if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
57 return 1;
58
59+ if (crtl->calls_eh_return
60+ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
61+ return 1;
62+ }
63+
64 if (!crtl->is_leaf)
65 {
66 if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
67@@ -1923,6 +1928,13 @@ microblaze_must_save_register (int regno)
68 return 1;
69 }
70
71+ if (crtl->calls_eh_return
72+ && (regno == EH_RETURN_DATA_REGNO (0)
73+ || regno == EH_RETURN_DATA_REGNO (1)))
74+ {
75+ return 1;
76+ }
77+
78 return 0;
79 }
80
81@@ -2939,6 +2951,12 @@ microblaze_expand_epilogue (void)
82 emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
83 }
84
85+ if (crtl->calls_eh_return)
86+ emit_insn (gen_addsi3 (stack_pointer_rtx,
87+ stack_pointer_rtx,
88+ gen_rtx_raw_REG (SImode,
89+ MB_EH_STACKADJ_REGNUM)));
90+
91 emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
92 MB_ABI_SUB_RETURN_ADDR_REGNUM)));
93 }
94@@ -3166,10 +3184,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
95 if (count != 0)
96 return NULL_RTX;
97
98- return gen_rtx_PLUS (Pmode,
99- get_hard_reg_initial_val (Pmode,
100- MB_ABI_SUB_RETURN_ADDR_REGNUM),
101- GEN_INT (8));
102+ return get_hard_reg_initial_val (Pmode,
103+ MB_ABI_SUB_RETURN_ADDR_REGNUM);
104+}
105+
106+void microblaze_eh_return (rtx op0)
107+{
108+ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
109 }
110
111 /* Queue an .ident string in the queue of top-level asm statements.
112diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
113index bc4d9a1..074b78e 100644
114--- a/gcc/config/microblaze/microblaze.h
115+++ b/gcc/config/microblaze/microblaze.h
116@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe;
117 #define INCOMING_RETURN_ADDR_RTX \
118 gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
119
120+/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
121+#define RETURN_ADDR_OFFSET (8)
122+
123+/* Describe how we implement __builtin_eh_return. */
124+#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
125+
126+#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
127+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
128+
129+/* Select a format to encode pointers in exception handling data. CODE
130+ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
131+ true if the symbol may be affected by dynamic relocations. */
132+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
133+ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
134+
135 /* Use DWARF 2 debugging information by default. */
136 #define DWARF2_DEBUGGING_INFO
137 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
138diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
139index 3618cad..4e7fe3b 100644
140--- a/gcc/config/microblaze/microblaze.md
141+++ b/gcc/config/microblaze/microblaze.md
142@@ -2221,3 +2221,13 @@
143 [(set_attr "type" "arith")
144 (set_attr "mode" "SI")
145 (set_attr "length" "4")])
146+
147+; This is used in compiling the unwind routines.
148+(define_expand "eh_return"
149+ [(use (match_operand 0 "general_operand" ""))]
150+ ""
151+ "
152+{
153+ microblaze_eh_return(operands[0]);
154+ DONE;
155+}")
156--
1571.7.5.4
158