+2018-08-03 Dimitar Dimitrov <dimitar@dinux.eu>
+
+ * config/tc-pru.c (pru_regname_to_dw2regnum): Return the starting HW
+ byte-register number.
+ (pru_frame_initial_instructions): Use byte-numbering for FP index.
+ * config/tc-pru.h (DWARF2_DEFAULT_RETURN_COLUMN): Use number from
+ latest GCC.
+ (DWARF2_CIE_DATA_ALIGNMENT): Set to -1.
+
2018-08-03 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (Operand_Mem): Define.
}
/* Implement tc_regname_to_dw2regnum, to convert REGNAME to a DWARF-2
- register number. */
+ register number. Return the starting HW byte-register number. */
+
int
pru_regname_to_dw2regnum (char *regname)
{
+ static const unsigned int regstart[RSEL_NUM_ITEMS] =
+ {
+ [RSEL_7_0] = 0,
+ [RSEL_15_8] = 1,
+ [RSEL_23_16] = 2,
+ [RSEL_31_24] = 3,
+ [RSEL_15_0] = 0,
+ [RSEL_23_8] = 1,
+ [RSEL_31_16] = 2,
+ [RSEL_31_0] = 0,
+ };
+
struct pru_reg *r = pru_reg_lookup (regname);
- if (r == NULL)
+
+ if (r == NULL || r->regsel >= RSEL_NUM_ITEMS)
return -1;
- return r->index;
+ return r->index * 4 + regstart[r->regsel];
}
/* Implement tc_cfi_frame_initial_instructions, to initialize the DWARF-2
void
pru_frame_initial_instructions (void)
{
- const unsigned fp_regno = 4;
+ const unsigned fp_regno = 4 * 4;
cfi_add_CFA_def_cfa (fp_regno, 0);
}
/* We want .cfi_* pseudo-ops for generating unwind info. */
#define TARGET_USE_CFIPOP 1
-#define DWARF2_DEFAULT_RETURN_COLUMN 31
-#define DWARF2_CIE_DATA_ALIGNMENT (-4)
+
+/* Program Counter register number is not defined by TI documents.
+ Pick the virtual number used by GCC. */
+#define DWARF2_DEFAULT_RETURN_COLUMN 132
+
+/* The stack grows down, and is only byte aligned. */
+#define DWARF2_CIE_DATA_ALIGNMENT -1
+
#define tc_regname_to_dw2regnum pru_regname_to_dw2regnum
extern int pru_regname_to_dw2regnum (char *regname);
#define tc_cfi_frame_initial_instructions pru_frame_initial_instructions
/* PR ld/20906. A corrupt input file
can contain bogus strings. */
len = strlen (yylval.name);
- if (len > yyleng - 2)
+ if (len > (bfd_size_type) yyleng - 2)
len = yyleng - 2;
yylval.name[len] = 0;
return NAME;