Hi, Ian,
It is wrong to treat all 0x4 as DW_CFA_advance_loc4. .eh_frame can have
...
.byte 0x9a
.byte 0x4
.align 3
.4byte length
...
0x4 here is LEB128 for 0x9a. I believe this patch fixes the bug. Do you
have a better one?
Thanks.
--
H.J. Lu (hjl@gnu.org)
---
Sat Aug 29 07:18:45 1998 H.J. Lu (hjl@gnu.org)
* as.h (eh_frame_reset): New declaration.
* ehopt.c (eh_frame_reset): Reset saw_advance_loc4 to 0.
* read.c (s_align): Call eh_frame_reset ().
* config/tc-alpha.c (s_alpha_align): Likewise.
* config/tc-arm.c (s_align): Likewise.
* config/tc-hppa.c (pa_align): Likewise.
* config/tc-mips.c (s_align): Likewise.
Index: as.h
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/as.h,v
retrieving revision 1.13
diff -u -p -r1.13 as.h
--- as.h 1998/02/17 20:35:41 1.13
+++ as.h 1998/08/29 13:49:08
@@ -592,6 +592,7 @@ int check_eh_frame PARAMS ((struct expre
int eh_frame_estimate_size_before_relax PARAMS ((fragS *));
int eh_frame_relax_frag PARAMS ((fragS *));
void eh_frame_convert_frag PARAMS ((fragS *));
+void eh_frame_reset PARAMS ((void));
#include "expr.h" /* Before targ-*.h */
Index: ehopt.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/ehopt.c,v
retrieving revision 1.3
diff -u -p -r1.3 ehopt.c
--- ehopt.c 1998/03/31 22:25:05 1.3
+++ ehopt.c 1998/08/29 14:14:30
@@ -243,6 +243,16 @@ eh_frame_code_alignment ()
return code_alignment;
}
+static int saw_advance_loc4;
+
+/* This functon is called from various functions which handle ".align".
+ A .align marks the end of an FDE entry. */
+void
+eh_frame_reset ()
+{
+ saw_advance_loc4 = 0;
+}
+
/* This function is called from emit_expr. It looks for cases which
we can optimize.
@@ -261,7 +271,6 @@ check_eh_frame (exp, pnbytes)
expressionS *exp;
unsigned int *pnbytes;
{
- static int saw_advance_loc4;
static fragS *loc4_frag;
static int loc4_fix;
Index: read.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/read.c,v
retrieving revision 1.15
diff -u -p -r1.15 read.c
--- read.c 1998/05/27 16:38:41 1.15
+++ read.c 1998/08/29 13:48:30
@@ -1216,6 +1216,8 @@ s_align (arg, bytes_p)
int max;
int fill_p;
+ eh_frame_reset ();
+
if (flag_mri)
stop = mri_comment_field (&stopc);
Index: config/tc-alpha.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-alpha.c,v
retrieving revision 1.11
diff -u -p -r1.11 tc-alpha.c
--- config/tc-alpha.c 1998/03/04 17:58:19 1.11
+++ config/tc-alpha.c 1998/08/29 14:04:53
@@ -4161,6 +4161,8 @@ s_alpha_align (ignore)
char fill, *pfill;
long max_alignment = 15;
+ eh_frame_reset ();
+
align = get_absolute_expression ();
if (align > max_alignment)
{
Index: config/tc-arm.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-arm.c,v
retrieving revision 1.17
diff -u -p -r1.17 tc-arm.c
--- config/tc-arm.c 1998/06/29 15:37:06 1.17
+++ config/tc-arm.c 1998/08/29 14:09:10
@@ -1166,6 +1166,8 @@ s_align (unused) /* Same as s_align_ptwo
register long temp_fill;
long max_alignment = 15;
+ eh_frame_reset ();
+
temp = get_absolute_expression ();
if (temp > max_alignment)
as_bad ("Alignment too large: %d. assumed.", temp = max_alignment);
Index: config/tc-hppa.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-hppa.c,v
retrieving revision 1.1.1.24
diff -u -p -r1.1.1.24 tc-hppa.c
--- config/tc-hppa.c 1997/10/25 21:55:39 1.1.1.24
+++ config/tc-hppa.c 1998/08/29 14:09:45
@@ -4026,6 +4026,8 @@ pa_parse_neg_add_cmpltr (s, isbranch)
static void
pa_align (bytes)
{
+ eh_frame_reset ();
+
/* We must have a valid space and subspace. */
pa_check_current_space_and_subspace ();
Index: config/tc-mips.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-mips.c,v
retrieving revision 1.31
diff -u -p -r1.31 tc-mips.c
--- config/tc-mips.c 1998/03/25 17:09:26 1.31
+++ config/tc-mips.c 1998/08/29 14:10:47
@@ -9595,6 +9595,8 @@ s_align (x)
register long temp_fill;
long max_alignment = 15;
+ eh_frame_reset ();
+
/*
o Note that the assembler pulls down any immediately preceeding label