Hi Guys, I am applying the attached patch to fix the FRV backend so that the frv-elf toolchain will build.
The patch to frv_function_prologue was actually created by Bernd, and I have been using it in my local tree for some time now. It works around a problem generating dwarf2 debug information for function prologues when sometimes CALL_ARG_LOCATION notes can be separated from their CALL insns. Cheers Nick gcc/ChangeLog 2011-09-29 Nick Clifton <ni...@redhat.com> Bernd Schmidt <ber...@codesourcery.com> * config/frv/frvbegin.c: Fix location of unwind-dw2-fde.h header file. * config/frv/frvend.c: Likewise. * config/frv/frv.c (frv_function_prologue): Move misplaced CALL_ARG_LOCATION notes back to their proper locations. Index: gcc/config/frv/frvbegin.c =================================================================== --- gcc/config/frv/frvbegin.c (revision 179334) +++ gcc/config/frv/frvbegin.c (working copy) @@ -28,7 +28,7 @@ #include "defaults.h" #include <stddef.h> -#include "unwind-dw2-fde.h" +#include "../libgcc/unwind-dw2-fde.h" #include "gbl-ctors.h" /* Declare a pointer to void function type. */ Index: gcc/config/frv/frvend.c =================================================================== --- gcc/config/frv/frvend.c (revision 179334) +++ gcc/config/frv/frvend.c (working copy) @@ -25,7 +25,7 @@ #include "defaults.h" #include <stddef.h> -#include "unwind-dw2-fde.h" +#include "../libgcc/unwind-dw2-fde.h" #ifdef __FRV_UNDERSCORE__ #define UNDERSCORE "_" Index: gcc/config/frv/frv.c =================================================================== --- gcc/config/frv/frv.c (revision 179334) +++ gcc/config/frv/frv.c (working copy) @@ -1424,6 +1424,8 @@ static void frv_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) { + rtx insn, next, last_call; + /* If no frame was created, check whether the function uses a call instruction to implement a far jump. If so, save the link in gr3 and replace all returns to LR with returns to GR3. GR3 is used because it @@ -1464,6 +1466,32 @@ /* Allow the garbage collector to free the nops created by frv_reorg. */ memset (frv_nops, 0, sizeof (frv_nops)); + + /* Locate CALL_ARG_LOCATION notes that have been misplaced + and move them back to where they should be located. */ + last_call = NULL_RTX; + for (insn = get_insns (); insn; insn = next) + { + next = NEXT_INSN (insn); + if (CALL_P (insn) + || (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE + && CALL_P (XVECEXP (PATTERN (insn), 0, 0)))) + last_call = insn; + + if (!NOTE_P (insn) || NOTE_KIND (insn) != NOTE_INSN_CALL_ARG_LOCATION) + continue; + + if (NEXT_INSN (last_call) == insn) + continue; + + NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn); + PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn); + PREV_INSN (insn) = last_call; + NEXT_INSN (insn) = NEXT_INSN (last_call); + PREV_INSN (NEXT_INSN (insn)) = insn; + NEXT_INSN (PREV_INSN (insn)) = insn; + last_call = insn; + } }