From 921e5f0a315d8bded89c0d6e41ab467b8887a418 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Wed, 1 Jul 2009 11:44:54 +0000 Subject: [PATCH] 2009-07-01 Paul Brook gas/ * config/tc-arm.c (MISSING_FNSTART): Define. (s_arm_unwind_fnstart): Diagnose duplicate directive. (s_arm_unwind_handlerdata, s_arm_unwind_fnend, s_arm_unwind_fnend, s_arm_unwind_cantunwind, s_arm_unwind_personalityindex, s_arm_unwind_personality, s_arm_unwind_save, s_arm_unwind_movsp, s_arm_unwind_pad, s_arm_unwind_setfp, s_arm_unwind_raw): Error if not inside function unwinding region. gas/testsuite/ * gas/arm/fp-save.s: Add .fnstart and .fnend directives. --- gas/ChangeLog | 10 ++++++++++ gas/config/tc-arm.c | 42 +++++++++++++++++++++++++++++++++++++++++ gas/testsuite/ChangeLog | 4 ++++ gas/testsuite/gas/arm/fp-save.s | 2 ++ 4 files changed, 58 insertions(+) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6d09980..32bb413 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2009-07-01 Paul Brook + + * config/tc-arm.c (MISSING_FNSTART): Define. + (s_arm_unwind_fnstart): Diagnose duplicate directive. + (s_arm_unwind_handlerdata, s_arm_unwind_fnend, s_arm_unwind_fnend, + s_arm_unwind_cantunwind, s_arm_unwind_personalityindex, + s_arm_unwind_personality, s_arm_unwind_save, s_arm_unwind_movsp, + s_arm_unwind_pad, s_arm_unwind_setfp, s_arm_unwind_raw): Error if + not inside function unwinding region. + 2009-06-29 H.J. Lu * config/tc-i386.c: Reformat. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index e853f23..35498f2 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -701,6 +701,7 @@ struct asm_opcode #define BAD_OUT_IT _("thumb conditional instruction should be in IT block") #define BAD_IT_COND _("incorrect condition in IT block") #define BAD_IT_IT _("IT falling in the range of a previous IT block") +#define MISSING_FNSTART _("missing .fnstart before unwinding directive") static struct hash_control *arm_ops_hsh; static struct hash_control *arm_cond_hsh; @@ -3156,6 +3157,12 @@ static void s_arm_unwind_fnstart (int ignored ATTRIBUTE_UNUSED) { demand_empty_rest_of_line (); + if (unwind.proc_start) + { + as_bad(_("duplicate .fnstart directive")); + return; + } + /* Mark the start of the function. */ unwind.proc_start = expr_build_dot (); @@ -3179,6 +3186,9 @@ static void s_arm_unwind_handlerdata (int ignored ATTRIBUTE_UNUSED) { demand_empty_rest_of_line (); + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + if (unwind.table_entry) as_bad (_("duplicate .handlerdata directive")); @@ -3196,6 +3206,12 @@ s_arm_unwind_fnend (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); + if (!unwind.proc_start) + { + as_bad(_(".fnend directive without .fnstart")); + return; + } + /* Add eh table entry. */ if (unwind.table_entry == NULL) val = create_unwind_entry (0); @@ -3242,6 +3258,8 @@ s_arm_unwind_fnend (int ignored ATTRIBUTE_UNUSED) /* Restore the original section. */ subseg_set (unwind.saved_seg, unwind.saved_subseg); + + unwind.proc_start = NULL; } @@ -3251,6 +3269,9 @@ static void s_arm_unwind_cantunwind (int ignored ATTRIBUTE_UNUSED) { demand_empty_rest_of_line (); + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + if (unwind.personality_routine || unwind.personality_index != -1) as_bad (_("personality routine specified for cantunwind frame")); @@ -3265,6 +3286,9 @@ s_arm_unwind_personalityindex (int ignored ATTRIBUTE_UNUSED) { expressionS exp; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + if (unwind.personality_routine || unwind.personality_index != -1) as_bad (_("duplicate .personalityindex directive")); @@ -3291,6 +3315,9 @@ s_arm_unwind_personality (int ignored ATTRIBUTE_UNUSED) { char *name, *p, c; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + if (unwind.personality_routine || unwind.personality_index != -1) as_bad (_("duplicate .personality directive")); @@ -3727,6 +3754,9 @@ s_arm_unwind_save (int arch_v6) struct reg_entry *reg; bfd_boolean had_brace = FALSE; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + /* Figure out what sort of save we have. */ peek = input_line_pointer; @@ -3784,6 +3814,9 @@ s_arm_unwind_movsp (int ignored ATTRIBUTE_UNUSED) valueT op; int offset; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + reg = arm_reg_parse (&input_line_pointer, REG_TYPE_RN); if (reg == FAIL) { @@ -3829,6 +3862,9 @@ s_arm_unwind_pad (int ignored ATTRIBUTE_UNUSED) { int offset; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + if (immediate_for_directive (&offset) == FAIL) return; @@ -3855,6 +3891,9 @@ s_arm_unwind_setfp (int ignored ATTRIBUTE_UNUSED) int fp_reg; int offset; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + fp_reg = arm_reg_parse (&input_line_pointer, REG_TYPE_RN); if (skip_past_comma (&input_line_pointer) == FAIL) sp_reg = FAIL; @@ -3905,6 +3944,9 @@ s_arm_unwind_raw (int ignored ATTRIBUTE_UNUSED) unsigned char op[16]; int count; + if (!unwind.proc_start) + as_bad(MISSING_FNSTART); + expression (&exp); if (exp.X_op == O_constant && skip_past_comma (&input_line_pointer) != FAIL) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 678a0a2..09149bb 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-07-01 Paul Brook + + * gas/arm/fp-save.s: Add .fnstart and .fnend directives. + 2009-06-30 Nick Clifton PR 10288 diff --git a/gas/testsuite/gas/arm/fp-save.s b/gas/testsuite/gas/arm/fp-save.s index d86d749..d0a572a 100644 --- a/gas/testsuite/gas/arm/fp-save.s +++ b/gas/testsuite/gas/arm/fp-save.s @@ -1,2 +1,4 @@ + .fnstart sfmfd f4, 1, [sp]! .save f4, 1 + .fnend -- 2.7.4