diff options
author | Richard Henderson <rth@redhat.com> | 2010-09-02 22:43:46 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2010-09-02 22:43:46 +0000 |
commit | 3251495bd703dad0798b68acb17205f02b293f4b (patch) | |
tree | 9c120343d3a05742a1411503f27e6d042e504b34 /gas/dw2gencfi.c | |
parent | b129eb0e566d53a2500d505cbb80e8ad4ad6f981 (diff) | |
download | gdb-3251495bd703dad0798b68acb17205f02b293f4b.zip gdb-3251495bd703dad0798b68acb17205f02b293f4b.tar.gz gdb-3251495bd703dad0798b68acb17205f02b293f4b.tar.bz2 |
* dw2gencfi.c (TC_DWARF2_EMIT_OFFSET): Provide default.
(output_fde): Use it. Make sure to fully init exp before using it.
testsuite/
* gas/cfi/cfi-common-1.d: Use objdump instead of readelf to dump.
* gas/cfi/cfi-common-2.d, gas/cfi/cfi-common-3.d,
gas/cfi/cfi-common-4.d, gas/cfi/cfi-common-6.d,
gas/cfi/cfi-common-7.d, gas/cfi/cfi-x86_64.d: Likewise.
* gas/cfi/cfi-x86_64.s: Remove .type directives.
* gas/cfi/cfi.exp: Run for pecoff objects too.
* gas/cfi/reloc-pe-i386.d, gas/cfi/reloc-pe-i386.s: New test.
Diffstat (limited to 'gas/dw2gencfi.c')
-rw-r--r-- | gas/dw2gencfi.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 36bd8d8..974cdfb 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -76,6 +76,24 @@ # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8) #endif +/* ??? Share this with dwarf2cfg.c. */ +#ifndef TC_DWARF2_EMIT_OFFSET +#define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset + +/* Create an offset to .dwarf2_*. */ + +static void +generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size) +{ + expressionS exp; + + exp.X_op = O_symbol; + exp.X_add_symbol = symbol; + exp.X_add_number = 0; + emit_expr (&exp, size); +} +#endif + struct cfi_escape_data { struct cfi_escape_data *next; expressionS exp; @@ -1405,19 +1423,21 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie, if (eh_frame) { + exp.X_op = O_subtract; exp.X_add_symbol = after_size_address; exp.X_op_symbol = cie->start_address; + exp.X_add_number = 0; + emit_expr (&exp, offset_size); /* CIE offset. */ } else { - exp.X_op = O_symbol; - exp.X_add_symbol = cie->start_address; - exp.X_op_symbol = NULL; + TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size); } - emit_expr (&exp, offset_size); /* CIE offset. */ if (eh_frame) { + exp.X_op = O_subtract; + exp.X_add_number = 0; #if CFI_DIFF_EXPR_OK exp.X_add_symbol = fde->start_address; exp.X_op_symbol = symbol_temp_new_now (); @@ -1425,7 +1445,6 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie, #else exp.X_op = O_symbol; exp.X_add_symbol = fde->start_address; - exp.X_op_symbol = NULL; #ifdef tc_cfi_emit_pcrel_expr tc_cfi_emit_pcrel_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ #else @@ -1436,7 +1455,9 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie, } else { + exp.X_op = O_symbol; exp.X_add_symbol = fde->start_address; + exp.X_add_number = 0; addr_size = DWARF2_ADDR_SIZE (stdoutput); emit_expr (&exp, addr_size); } @@ -1444,6 +1465,7 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie, exp.X_op = O_subtract; exp.X_add_symbol = fde->end_address; exp.X_op_symbol = fde->start_address; /* Code length. */ + exp.X_add_number = 0; emit_expr (&exp, addr_size); augmentation_size = encoding_size (fde->lsda_encoding); |