segT current_seg;
subsegT current_subseg;
fragS *f;
+ fixS *fix;
int offset;
+ char augmentation[10];
+ int iaug;
if (code_alignment != 0)
return code_alignment;
current_subseg = now_subseg;
subseg_new (".eh_frame", 0);
f = seg_info (now_seg)->frchainP->frch_root;
+ fix = seg_info (now_seg)->frchainP->fix_root;
subseg_set (current_seg, current_subseg);
/* Look through the frags of the section to find the code alignment. */
/* Skip the augmentation (a null terminated string). */
+ iaug = 0;
++offset;
while (1)
{
return -1;
}
while (offset < f->fr_fix && f->fr_literal[offset] != '\0')
- ++offset;
+ {
+ if (iaug < (sizeof augmentation) - 1)
+ {
+ augmentation[iaug] = f->fr_literal[offset];
+ ++iaug;
+ }
+ ++offset;
+ }
if (offset < f->fr_fix)
break;
}
return -1;
}
+ 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;
+ if (fix == NULL)
+ offset += 4;
+ else
+ offset += fix->fx_size;
+ while (f != NULL && offset >= f->fr_fix)
+ {
+ offset -= f->fr_fix;
+ f = f->fr_next;
+ }
+ if (f == NULL)
+ {
+ code_alignment = -1;
+ 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. */
/* Don't optimize. */
}
else if (exp->X_add_number % ca == 0
- && exp->X_add_number / ca < 0x40)
+ && exp->X_add_number / ca < 0x40)
{
loc4_frag->fr_literal[loc4_fix]
= DW_CFA_advance_loc | (exp->X_add_number / ca);
frag_var (rs_cfa, 4, 0, 0, make_expr_symbol (exp),
loc4_fix, (char *) loc4_frag);
+
+ return 1;
}
else
saw_advance_loc4 = 0;
frag->fr_fix += frag->fr_subtype;
frag->fr_type = rs_fill;
+ frag->fr_offset = 0;
}