kumquat-buildroot/package/gcc/5.5.0/840-microblaze-enable-dwarf-eh-support.patch

167 lines
5.8 KiB
Diff
Raw Normal View History

gcc: add support for gcc 5.1 This commit adds support for gcc 5.1 in Buildroot. In terms of gcc patches, compared to gcc 4.9.x: * Kept as is, sometimes after minor adjusments: 100-uclibc-conf.patch 301-missing-execinfo_h.patch 810-arm-softfloat-libgcc.patch 830-arm_unbreak_armv4t.patch 840-microblaze-enable-dwarf-eh-support.patch 850-libstdcxx-uclibc-c99.patch 860-cilk-wchar.patch * Dropped: 110-pr64896.patch 111-pr65730.patch * Split in multiple parts: 900-musl-support.patch The patches from Crosstool-NG for muls support are used instead of one single patch. * Renamed: 910-gcc-poison-system-directories.patch to 200-gcc-poison-system-directories.patch 920-libgcc-remove-unistd-header.patch to 201-libgcc-remove-unistd-header.patch Since the 9xx part of the series is now used by the various musl related patches. We have tested the following configurations, with a minimal Busybox system: * ARM, uClibc-ng * ARM, glibc * ARM, musl * x86, uClibc-ng and uClibc 0.9.33.2 * x86, glibc * x86, musl All of the configurations built fine. All the configurations boot fine in Qemu, except x86/uClibc (either ng or 0.9.33.2), it segfaults when running init: devtmpfs: mounted Freeing unused kernel memory: 300K (c1389000 - c13d4000) init[1]: segfault at 0 ip b77708c1 sp bfa9bb0c error 4 in ld-uClibc-0.9.33.2.so[b776c000+6000] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b We'll give some time for the uClibc developers to fix the problem before taking other measures in Buildroot to exclude gcc 5.1 from a x86/uClibc configuration. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-06-14 16:33:28 +02:00
Fetched from Xilinx gcc git at https://github.com/Xilinx/gcc
From 23c35173490ac2d6348a668dfc9c1a6eb62171f2 Mon Sep 17 00:00:00 2001
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Date: Mon, 18 Jun 2012 20:18:13 +0200
Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support.
Changelog
2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
David Holsgrove <david.holsgrove@xilinx.com>
* common/config/microblaze/microblaze-common.c: Remove
TARGET_EXCEPT_UNWIND_INFO definition.
* config/microblaze/microblaze-protos.h: Add
microblaze_eh_return prototype.
* gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
microblaze_expand_epilogue, microblaze_return_addr): Handle
calls_eh_return
(microblaze_eh_return): New function.
* gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
ASM_PREFERRED_EH_DATA_FORMAT
* gcc/config/microblaze/microblaze.md: Define eh_return pattern.
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
gcc/common/config/microblaze/microblaze-common.c | 3 ---
gcc/config/microblaze/microblaze-protos.h | 1 +
gcc/config/microblaze/microblaze.c | 29 ++++++++++++++++++++----
gcc/config/microblaze/microblaze.h | 15 ++++++++++++
gcc/config/microblaze/microblaze.md | 11 +++++++++
5 files changed, 52 insertions(+), 7 deletions(-)
Index: b/gcc/common/config/microblaze/microblaze-common.c
===================================================================
--- a/gcc/common/config/microblaze/microblaze-common.c
+++ b/gcc/common/config/microblaze/microblaze-common.c
@@ -37,7 +37,4 @@
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
-#undef TARGET_EXCEPT_UNWIND_INFO
-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
-
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
Index: b/gcc/config/microblaze/microblaze-protos.h
===================================================================
--- a/gcc/config/microblaze/microblaze-protos.h
+++ b/gcc/config/microblaze/microblaze-protos.h
@@ -56,6 +56,7 @@
extern int symbol_mentioned_p (rtx);
extern int label_mentioned_p (rtx);
extern bool microblaze_cannot_force_const_mem (machine_mode, rtx);
+extern void microblaze_eh_return (rtx op0);
#endif /* RTX_CODE */
/* Declare functions in microblaze-c.c. */
Index: b/gcc/config/microblaze/microblaze.c
===================================================================
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -1959,6 +1959,11 @@
if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
return 1;
+ if (crtl->calls_eh_return
+ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
+ return 1;
+ }
+
if (!crtl->is_leaf)
{
if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
@@ -1986,6 +1991,13 @@
return 1;
}
+ if (crtl->calls_eh_return
+ && (regno == EH_RETURN_DATA_REGNO (0)
+ || regno == EH_RETURN_DATA_REGNO (1)))
+ {
+ return 1;
+ }
+
return 0;
}
@@ -3067,6 +3079,12 @@
emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
}
+ if (crtl->calls_eh_return)
+ emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx,
+ gen_rtx_raw_REG (SImode,
+ MB_EH_STACKADJ_REGNUM)));
+
emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
MB_ABI_SUB_RETURN_ADDR_REGNUM)));
}
@@ -3364,10 +3382,13 @@
if (count != 0)
return NULL_RTX;
- return gen_rtx_PLUS (Pmode,
- get_hard_reg_initial_val (Pmode,
- MB_ABI_SUB_RETURN_ADDR_REGNUM),
- GEN_INT (8));
+ return get_hard_reg_initial_val (Pmode,
+ MB_ABI_SUB_RETURN_ADDR_REGNUM);
+}
+
+void microblaze_eh_return (rtx op0)
+{
+ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
}
/* Queue an .ident string in the queue of top-level asm statements.
Index: b/gcc/config/microblaze/microblaze.h
===================================================================
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -184,6 +184,21 @@
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
+/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
+#define RETURN_ADDR_OFFSET (8)
+
+/* Describe how we implement __builtin_eh_return. */
+#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
+
+#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
+
+/* Select a format to encode pointers in exception handling data. CODE
+ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
+ true if the symbol may be affected by dynamic relocations. */
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
+ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
+
/* Use DWARF 2 debugging information by default. */
#define DWARF2_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
Index: b/gcc/config/microblaze/microblaze.md
===================================================================
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -2272,4 +2272,15 @@
(set_attr "mode" "SI")
(set_attr "length" "4")])
+; This is used in compiling the unwind routines.
+(define_expand "eh_return"
+ [(use (match_operand 0 "general_operand" ""))]
+ ""
+ "
+{
+ microblaze_eh_return(operands[0]);
+ DONE;
+}")
+
(include "sync.md")
+