aboutsummaryrefslogtreecommitdiff
path: root/gas/ehopt.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1998-02-06 23:14:42 +0000
committerIan Lance Taylor <ian@airs.com>1998-02-06 23:14:42 +0000
commiteb0a94a1738abf018a666634ffa55fda70b45c59 (patch)
tree11100c5fcbba6fcf3577e838ffdaf58f5284d10b /gas/ehopt.c
parent6766132db900a56b376fa8f6181d41b1ab792c33 (diff)
downloadgdb-eb0a94a1738abf018a666634ffa55fda70b45c59.zip
gdb-eb0a94a1738abf018a666634ffa55fda70b45c59.tar.gz
gdb-eb0a94a1738abf018a666634ffa55fda70b45c59.tar.bz2
more tweaks
Diffstat (limited to 'gas/ehopt.c')
-rw-r--r--gas/ehopt.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/gas/ehopt.c b/gas/ehopt.c
index efc9337..cb900e0 100644
--- a/gas/ehopt.c
+++ b/gas/ehopt.c
@@ -97,7 +97,8 @@ eh_frame_code_alignment ()
fragS *f;
fixS *fix;
int offset;
- int eh_state;
+ char augmentation[10];
+ int iaug;
if (code_alignment != 0)
return code_alignment;
@@ -150,8 +151,8 @@ eh_frame_code_alignment ()
/* Skip the augmentation (a null terminated string). */
+ iaug = 0;
++offset;
- eh_state = 0;
while (1)
{
while (f != NULL && offset >= f->fr_fix)
@@ -166,19 +167,10 @@ eh_frame_code_alignment ()
}
while (offset < f->fr_fix && f->fr_literal[offset] != '\0')
{
- switch (eh_state)
+ if (iaug < (sizeof augmentation) - 1)
{
- case 0:
- if (f->fr_literal[offset] == 'e')
- eh_state = 1;
- break;
- case 1:
- if (f->fr_literal[offset] == 'h')
- eh_state = 2;
- break;
- default:
- eh_state = 3;
- break;
+ augmentation[iaug] = f->fr_literal[offset];
+ ++iaug;
}
++offset;
}
@@ -197,11 +189,15 @@ eh_frame_code_alignment ()
return -1;
}
- /* If the augmentation field is "eh", then we have to skip a
- pointer. Unfortunately, we don't know how large it is. We find
- out by looking for a matching fixup. */
- if (eh_state == 2)
+ augmentation[iaug] = '\0';
+ if (augmentation[0] == '\0')
{
+ /* No augmentation. */
+ }
+ else if (strcmp (augmentation, "eh") == 0)
+ {
+ /* We have to skip a pointer. Unfortunately, we don't know how
+ large it is. We find out by looking for a matching fixup. */
while (fix != NULL
&& (fix->fx_frag != f || fix->fx_where != offset))
fix = fix->fx_next;
@@ -220,6 +216,11 @@ eh_frame_code_alignment ()
return -1;
}
}
+ else
+ {
+ code_alignment = -1;
+ return -1;
+ }
/* We're now at the code alignment factor, which is a ULEB128. If
it isn't a single byte, forget it. */