gas/dw2gencfi.c (output_cie): cleanup
Thomas Schwinge
thomas@codesourcery.com
Mon Jan 25 11:33:00 GMT 2010
Hello!
I was confused by this code: why should cie->per_encoding data or
cie->lsda_encoding data ever be emitted if (in the block just before)
their lengths are taken into account only for eh_frame == TRUE? It so
happens that in that case that output_cie is called with eh_frame ==
FALSE (only by select_cie_for_fde; in turn only by cfi_finish), then
fde->per_encoding as well as fde->lsda_encoding will always be set to
DW_EH_PE_omit. Yet, this could be made more explicit in output_cie.
gas/
2010-01-25 Thomas Schwinge <thomas@codesourcery.com>
* dw2gencfi.c (output_cie): Make it more explicit which code paths
belong to .eh_frame only.
There are two possible patches: The first one's diff is shorter, the
second one's resulting code looks more coherent (IMO, anyway) ;-). Pick
the one you prefer.
Index: dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.45
diff -u -p -r1.45 dw2gencfi.c
--- dw2gencfi.c 4 Nov 2009 09:52:00 -0000 1.45
+++ dw2gencfi.c 15 Jan 2010 11:27:58 -0000
@@ -1320,7 +1320,8 @@ output_cie (struct cie_entry *cie, bfd_b
augmentation_size += 1 + encoding_size (cie->per_encoding);
out_uleb128 (augmentation_size); /* Augmentation size. */
}
- if (cie->per_encoding != DW_EH_PE_omit)
+ if (eh_frame
+ && cie->per_encoding != DW_EH_PE_omit)
{
offsetT size = encoding_size (cie->per_encoding);
out_one (cie->per_encoding);
@@ -1340,7 +1341,8 @@ output_cie (struct cie_entry *cie, bfd_b
else
emit_expr (&exp, size);
}
- if (cie->lsda_encoding != DW_EH_PE_omit)
+ if (eh_frame
+ && cie->lsda_encoding != DW_EH_PE_omit)
out_one (cie->lsda_encoding);
switch (DWARF2_FDE_RELOC_SIZE)
Index: dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.45
diff -u -p -r1.45 dw2gencfi.c
--- dw2gencfi.c 4 Nov 2009 09:52:00 -0000 1.45
+++ dw2gencfi.c 25 Jan 2010 10:51:12 -0000
@@ -1319,29 +1319,31 @@ output_cie (struct cie_entry *cie, bfd_b
if (cie->per_encoding != DW_EH_PE_omit)
augmentation_size += 1 + encoding_size (cie->per_encoding);
out_uleb128 (augmentation_size); /* Augmentation size. */
- }
- if (cie->per_encoding != DW_EH_PE_omit)
- {
- offsetT size = encoding_size (cie->per_encoding);
- out_one (cie->per_encoding);
- exp = cie->personality;
- if ((cie->per_encoding & 0x70) == DW_EH_PE_pcrel)
+
+ if (cie->per_encoding != DW_EH_PE_omit)
{
+ offsetT size = encoding_size (cie->per_encoding);
+ out_one (cie->per_encoding);
+ exp = cie->personality;
+ if ((cie->per_encoding & 0x70) == DW_EH_PE_pcrel)
+ {
#if CFI_DIFF_EXPR_OK
- exp.X_op = O_subtract;
- exp.X_op_symbol = symbol_temp_new_now ();
- emit_expr (&exp, size);
+ exp.X_op = O_subtract;
+ exp.X_op_symbol = symbol_temp_new_now ();
+ emit_expr (&exp, size);
#elif defined (tc_cfi_emit_pcrel_expr)
- tc_cfi_emit_pcrel_expr (&exp, size);
+ tc_cfi_emit_pcrel_expr (&exp, size);
#else
- abort ();
+ abort ();
#endif
+ }
+ else
+ emit_expr (&exp, size);
}
- else
- emit_expr (&exp, size);
+
+ if (cie->lsda_encoding != DW_EH_PE_omit)
+ out_one (cie->lsda_encoding);
}
- if (cie->lsda_encoding != DW_EH_PE_omit)
- out_one (cie->lsda_encoding);
switch (DWARF2_FDE_RELOC_SIZE)
{
Regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100125/8de42097/attachment.sig>
More information about the Binutils
mailing list