aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@tuliptree.org>2001-02-21 22:39:59 +0000
committerJim Wilson <wilson@tuliptree.org>2001-02-21 22:39:59 +0000
commit33d01f331b0673ed67fa8a71c9cb90f7d35d16b7 (patch)
treeee034d403f66041d2b6f03db319859edf205ed6a
parentdd425adaa8da7d06250ea4303bd0275e790adeba (diff)
downloadgdb-33d01f331b0673ed67fa8a71c9cb90f7d35d16b7.zip
gdb-33d01f331b0673ed67fa8a71c9cb90f7d35d16b7.tar.gz
gdb-33d01f331b0673ed67fa8a71c9cb90f7d35d16b7.tar.bz2
Fix bugs in handling of the .restore directive.
* config/tc-ia64.c (struct unwind): Add member "prologue_count". (dot_proc): Clear unwind.prologue_count to zero. (dot_prologue): Increment unwind.prologue_count. (dot_restore): If second operand is omitted, use unwind.prologue_count -1 for "ecount" (# of additional regions to pop). Decrement unwind.prologue_count by number of regions popped.
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-ia64.c18
2 files changed, 24 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d7259a5..f18a868 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2001-02-21 David Mosberger <davidm@hpl.hp.com>
+
+ * config/tc-ia64.c (struct unwind): Add member "prologue_count".
+ (dot_proc): Clear unwind.prologue_count to zero.
+ (dot_prologue): Increment unwind.prologue_count.
+ (dot_restore): If second operand is omitted, use
+ unwind.prologue_count -1 for "ecount" (# of additional regions to
+ pop). Decrement unwind.prologue_count by number of regions
+ popped.
+
2001-02-21 Nick Clifton <nickc@redhat.com>
* doc/as.texinfo (Section): Note that some flags to the COFF
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index df566e2..56f80d9 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -624,6 +624,7 @@ static struct
/* TRUE if processing unwind directives in a prologue region. */
int prologue;
int prologue_mask;
+ unsigned int prologue_count; /* number of .prologues seen so far */
} unwind;
typedef void (*vbyte_func) PARAMS ((int, char *, char *));
@@ -3047,7 +3048,7 @@ dot_restore (dummy)
int dummy ATTRIBUTE_UNUSED;
{
expressionS e1, e2;
- unsigned long ecount = 0;
+ unsigned long ecount; /* # of _additional_ regions to pop */
int sep;
sep = parse_operand (&e1);
@@ -3060,14 +3061,21 @@ dot_restore (dummy)
if (sep == ',')
{
parse_operand (&e2);
- if (e1.X_op != O_constant)
+ if (e2.X_op != O_constant || e2.X_add_number < 0)
{
- as_bad ("Second operand to .restore must be constant");
+ as_bad ("Second operand to .restore must be a constant >= 0");
return;
}
- ecount = e1.X_op;
+ ecount = e2.X_add_number;
}
+ else
+ ecount = unwind.prologue_count - 1;
add_unwind_entry (output_epilogue (ecount));
+
+ if (ecount < unwind.prologue_count)
+ unwind.prologue_count -= ecount + 1;
+ else
+ unwind.prologue_count = 0;
}
static void
@@ -3710,6 +3718,7 @@ dot_proc (dummy)
demand_empty_rest_of_line ();
ia64_do_align (16);
+ unwind.prologue_count = 0;
unwind.list = unwind.tail = unwind.current_entry = NULL;
unwind.personality_routine = 0;
}
@@ -3764,6 +3773,7 @@ dot_prologue (dummy)
unwind.prologue = 1;
unwind.prologue_mask = mask;
+ ++unwind.prologue_count;
}
static void