From afe04ff799007b51a2e90a828f20df2137a04a90 Mon Sep 17 00:00:00 2001 From: Nathan Rossi Date: Fri, 27 Jun 2014 11:32:14 +1000 Subject: gcc: Updated GCC 4.8 MicroBlaze patch * Updated the MicroBlaze Thunk support patch. This patch has been accepted upstream, however it differs from the original patch. * The original patch was causing some issues with specific packages. Signed-off-by: Nathan Rossi --- ...blaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch | 116 --------------------- ...014-02-23-David-Holsgrove-david.holsgrove.patch | 108 +++++++++++++++++++ recipes-devtools/gcc/gcc-microblaze-4.8.inc | 2 +- 3 files changed, 109 insertions(+), 117 deletions(-) delete mode 100644 recipes-devtools/gcc/files/0004-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch create mode 100644 recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch (limited to 'recipes-devtools') diff --git a/recipes-devtools/gcc/files/0004-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch b/recipes-devtools/gcc/files/0004-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch deleted file mode 100644 index 5d2665eb..00000000 --- a/recipes-devtools/gcc/files/0004-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: David Holsgrove -Subject: [PATCH 4/8] [Patch, microblaze]: Add TARGET_ASM_OUTPUT_MI_THUNK to - support varargs thunk - -Without this macro, generic gcc generates a less efficient thunk -that calls function instead of jumping to it. The generic code -does not support varargs and produces an error message on compilation; - - error: generic thunk code fails for method - 'virtual void C::f(const char*, ...)' which uses '...' - -Changelog - -2013-03-18 David Holsgrove - - * gcc/config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk - and define TARGET_ASM_OUTPUT_MI_THUNK and TARGET_ASM_CAN_OUTPUT_MI_THUNK - -Signed-off-by: David Holsgrove -Upstream-Status: Pending - -diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c -index 1562e60..7418e49 100644 ---- a/gcc/config/microblaze/microblaze.c -+++ b/gcc/config/microblaze/microblaze.c -@@ -3005,6 +3005,74 @@ microblaze_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED, - } - - static void -+microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, -+ HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, -+ tree function) -+{ -+ rtx this_rtx, insn, funexp; -+ -+ reload_completed = 1; -+ epilogue_completed = 1; -+ -+ /* Mark the end of the (empty) prologue. */ -+ emit_note (NOTE_INSN_PROLOGUE_END); -+ -+ /* Find the "this" pointer. If the function returns a structure, -+ the structure return pointer is in MB_ABI_FIRST_ARG_REGNUM. */ -+ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) -+ this_rtx = gen_rtx_REG (Pmode, (MB_ABI_FIRST_ARG_REGNUM + 1)); -+ else -+ this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM); -+ -+ /* Apply the constant offset, if required. */ -+ if (delta) -+ emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta))); -+ -+ /* Apply the offset from the vtable, if required. */ -+ if (vcall_offset) -+ { -+ rtx vcall_offset_rtx = GEN_INT (vcall_offset); -+ rtx tmp = gen_rtx_REG (Pmode, MB_ABI_TEMP1_REGNUM); -+ -+ emit_move_insn (tmp, gen_rtx_MEM (Pmode, this_rtx)); -+ -+ rtx loc = gen_rtx_PLUS (Pmode, tmp, vcall_offset_rtx); -+ emit_move_insn (tmp, gen_rtx_MEM (Pmode, loc)); -+ -+ emit_insn (gen_addsi3 (this_rtx, this_rtx, tmp)); -+ } -+ -+ /* Generate a tail call to the target function. */ -+ if (!TREE_USED (function)) -+ { -+ assemble_external (function); -+ TREE_USED (function) = 1; -+ } -+ funexp = XEXP (DECL_RTL (function), 0); -+ -+ if (flag_pic) -+ { -+ rtx scratch = gen_rtx_REG (Pmode, MB_ABI_TEMP2_REGNUM); -+ rtx reg = microblaze_legitimize_address(funexp, scratch, FUNCTION_MODE); -+ emit_move_insn (scratch, reg); -+ funexp = scratch; -+ } -+ -+ emit_insn (gen_jump (funexp)); -+ -+ /* Run just enough of rest_of_compilation. This sequence was -+ "borrowed" from rs6000.c. */ -+ insn = get_insns (); -+ shorten_branches (insn); -+ final_start_function (insn, file, 1); -+ final (insn, file, 1); -+ final_end_function (); -+ -+ reload_completed = 0; -+ epilogue_completed = 0; -+} -+ -+static void - microblaze_globalize_label (FILE * stream, const char *name) - { - fputs ("\t.globl\t", stream); -@@ -3532,6 +3600,12 @@ microblaze_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x - #undef TARGET_SECONDARY_RELOAD - #define TARGET_SECONDARY_RELOAD microblaze_secondary_reload - -+#undef TARGET_ASM_OUTPUT_MI_THUNK -+#define TARGET_ASM_OUTPUT_MI_THUNK microblaze_asm_output_mi_thunk -+ -+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK -+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true -+ - #undef TARGET_SCHED_ADJUST_COST - #define TARGET_SCHED_ADJUST_COST microblaze_adjust_cost - --- -1.7.5.4 - diff --git a/recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch b/recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch new file mode 100644 index 00000000..efd127de --- /dev/null +++ b/recipes-devtools/gcc/files/0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch @@ -0,0 +1,108 @@ +From 0462b5fb1e91183c16e204e1a6cf436ef0d8d0f8 Mon Sep 17 00:00:00 2001 +From: eager +Date: Sun, 23 Feb 2014 18:44:27 +0000 +Subject: [PATCH] 2014-02-23 David Holsgrove + + * /config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk + and define TARGET_ASM_OUTPUT_MI_THUNK and + TARGET_ASM_CAN_OUTPUT_MI_THUNK. + +Upstream-Status: Backport +--- + gcc/config/microblaze/microblaze.c | 73 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 79 insertions(+) + +diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c +index 985d26a..ba8109b 100644 +--- a/gcc/config/microblaze/microblaze.c ++++ b/gcc/config/microblaze/microblaze.c +@@ -3087,6 +3087,73 @@ expand_pic_symbol_ref (enum machine_mode mode ATTRIBUTE_UNUSED, rtx op) + return result; + } + ++static void ++microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, ++ HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, ++ tree function) ++{ ++ rtx this_rtx, insn, funexp; ++ ++ reload_completed = 1; ++ epilogue_completed = 1; ++ ++ /* Mark the end of the (empty) prologue. */ ++ emit_note (NOTE_INSN_PROLOGUE_END); ++ ++ /* Find the "this" pointer. If the function returns a structure, ++ the structure return pointer is in MB_ABI_FIRST_ARG_REGNUM. */ ++ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) ++ this_rtx = gen_rtx_REG (Pmode, (MB_ABI_FIRST_ARG_REGNUM + 1)); ++ else ++ this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM); ++ ++ /* Apply the constant offset, if required. */ ++ if (delta) ++ emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta))); ++ ++ /* Apply the offset from the vtable, if required. */ ++ if (vcall_offset) ++ { ++ rtx vcall_offset_rtx = GEN_INT (vcall_offset); ++ rtx temp1 = gen_rtx_REG (Pmode, MB_ABI_TEMP1_REGNUM); ++ ++ emit_move_insn (temp1, gen_rtx_MEM (Pmode, this_rtx)); ++ ++ rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx); ++ emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc)); ++ ++ emit_insn (gen_addsi3 (this_rtx, this_rtx, temp1)); ++ } ++ ++ /* Generate a tail call to the target function. */ ++ if (!TREE_USED (function)) ++ { ++ assemble_external (function); ++ TREE_USED (function) = 1; ++ } ++ ++ funexp = XEXP (DECL_RTL (function), 0); ++ rtx temp2 = gen_rtx_REG (Pmode, MB_ABI_TEMP2_REGNUM); ++ ++ if (flag_pic) ++ emit_move_insn (temp2, expand_pic_symbol_ref (Pmode, funexp)); ++ else ++ emit_move_insn (temp2, funexp); ++ ++ emit_insn (gen_indirect_jump (temp2)); ++ ++ /* Run just enough of rest_of_compilation. This sequence was ++ "borrowed" from rs6000.c. */ ++ insn = get_insns (); ++ shorten_branches (insn); ++ final_start_function (insn, file, 1); ++ final (insn, file, 1); ++ final_end_function (); ++ ++ reload_completed = 0; ++ epilogue_completed = 0; ++} ++ + bool + microblaze_expand_move (enum machine_mode mode, rtx operands[]) + { +@@ -3504,6 +3571,12 @@ microblaze_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x + #undef TARGET_SECONDARY_RELOAD + #define TARGET_SECONDARY_RELOAD microblaze_secondary_reload + ++#undef TARGET_ASM_OUTPUT_MI_THUNK ++#define TARGET_ASM_OUTPUT_MI_THUNK microblaze_asm_output_mi_thunk ++ ++#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK ++#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true ++ + #undef TARGET_SCHED_ADJUST_COST + #define TARGET_SCHED_ADJUST_COST microblaze_adjust_cost + +-- +1.9.0 + diff --git a/recipes-devtools/gcc/gcc-microblaze-4.8.inc b/recipes-devtools/gcc/gcc-microblaze-4.8.inc index 675ecaf0..f0578dbd 100644 --- a/recipes-devtools/gcc/gcc-microblaze-4.8.inc +++ b/recipes-devtools/gcc/gcc-microblaze-4.8.inc @@ -5,7 +5,7 @@ SRC_URI_append += " \ file://0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch \ file://0002-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch \ file://0003-Patch-microblaze-Extend-jump-insn-to-accept-bri-to-S.patch \ - file://0004-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch \ + file://0462b5f-2014-02-23-David-Holsgrove-david.holsgrove.patch \ file://0005-Patch-microblaze-Add-fstack-usage-support.patch \ file://0006-Patch-microblaze-Remove-SECONDARY_MEMORY_NEEDED.patch \ file://0007-Patch-microblaze-Add-SIZE_TYPE-and-PTRDIFF_TYPE-to-m.patch \ -- cgit v1.2.3-54-g00ecf