From eafbc43f939a26cb4230d3d55ec637f441e3afe6 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 31 May 2003 19:36:45 +0000 Subject: [PATCH] * dw2gencfi.c (output_fde): Use fix_new to emit pc-relative reloc. (cfi_finish): Set flag_traditional_format around .eh_frame data. * gas/alpha/elf-reloc-8.d: Correct .eh_frame relocs. * gas/cfi/cfi-alpha-2.d: New. * gas/cfi/cfi-alpha-2.s: New. * gas/cfi/cfi.exp: Run it. --- gas/ChangeLog | 5 ++++ gas/dw2gencfi.c | 17 +++++++++++++- gas/testsuite/ChangeLog | 7 ++++++ gas/testsuite/gas/alpha/elf-reloc-8.d | 34 +++++++++++++-------------- gas/testsuite/gas/cfi/cfi-alpha-2.d | 9 +++++++ gas/testsuite/gas/cfi/cfi-alpha-2.s | 14 +++++++++++ gas/testsuite/gas/cfi/cfi.exp | 1 + 7 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-2.d create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-2.s diff --git a/gas/ChangeLog b/gas/ChangeLog index fc7d3fdbc03..34e844bbfff 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2003-05-31 Richard Henderson + + * dw2gencfi.c (output_fde): Use fix_new to emit pc-relative reloc. + (cfi_finish): Set flag_traditional_format around .eh_frame data. + 2003-05-29 Richard Henderson * config/tc-alpha.c (alpha_cur_ent_sym): Remove. diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 22395781393..ee67027ec53 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -666,9 +666,17 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie, exp.X_op_symbol = cie->start_address; emit_expr (&exp, 4); /* CIE offset */ + /* ??? Unsure why this works and the following doesn't. + Symptom was incorrect addends to the relocation. */ +#if 1 + memset (frag_more (4), 0, 4); /* Code offset */ + fix_new (frag_now, frag_now_fix () - 4, 4, + fde->start_address, 0, 1, BFD_RELOC_32); +#else exp.X_add_symbol = fde->start_address; exp.X_op_symbol = symbol_temp_new_now (); - emit_expr (&exp, 4); /* Code offset */ + emit_expr (&exp, 4); +#endif exp.X_add_symbol = fde->end_address; exp.X_op_symbol = fde->start_address; /* Code length */ @@ -770,6 +778,7 @@ cfi_finish (void) { segT cfi_seg; struct fde_entry *fde; + int save_flag_traditional_format; if (cur_fde_data) { @@ -789,6 +798,10 @@ cfi_finish (void) subseg_set (cfi_seg, 0); record_alignment (cfi_seg, 2); + /* Make sure check_eh_frame doesn't do anything with our output. */ + save_flag_traditional_format = flag_traditional_format; + flag_traditional_format = 1; + for (fde = all_fde_data; fde ; fde = fde->next) { struct cfi_insn_data *first; @@ -797,4 +810,6 @@ cfi_finish (void) cie = select_cie_for_fde (fde, &first); output_fde (fde, cie, first); } + + flag_traditional_format = save_flag_traditional_format; } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 11f87453c4b..82cef6c7cfc 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2003-05-31 Richard Henderson + + * gas/alpha/elf-reloc-8.d: Correct .eh_frame relocs. + * gas/cfi/cfi-alpha-2.d: New. + * gas/cfi/cfi-alpha-2.s: New. + * gas/cfi/cfi.exp: Run it. + 2003-05-29 Richard Henderson * gas/alpha/elf-reloc-8.d: Add .eh_frame relocs. diff --git a/gas/testsuite/gas/alpha/elf-reloc-8.d b/gas/testsuite/gas/alpha/elf-reloc-8.d index de5e0e88595..68f5678eb11 100644 --- a/gas/testsuite/gas/alpha/elf-reloc-8.d +++ b/gas/testsuite/gas/alpha/elf-reloc-8.d @@ -311,20 +311,20 @@ OFFSET *TYPE *VALUE RELOCATION RECORDS FOR \[\.eh_frame\]: OFFSET *TYPE *VALUE -0*000001c SREL32 \.init\.text\+0xf*ffffff8 -0*0000034 SREL32 \.init\.text\+0x0*0000048 -0*0000048 SREL32 \.init\.text\+0x0*0000078 -0*000005c SREL32 \.init\.text\+0x0*00000a8 -0*0000080 SREL32 \.init\.text\+0x0*00002b8 -0*00000a0 SREL32 \.init\.text\+0x0*0000598 -0*00000b8 SREL32 \.init\.text\+0x0*00005e8 -0*00000cc SREL32 \.init\.text\+0x0*0000608 -0*00000e0 SREL32 \.init\.text\+0x0*0000628 -0*00000fc SREL32 \.init\.text\+0x0*0000748 -0*0000120 SREL32 \.init\.text\+0x0*0000988 -0*000013c SREL32 \.init\.text\+0x0*0000a08 -0*0000150 SREL32 \.init\.text\+0x0*0000a18 -0*0000164 SREL32 \.init\.text\+0x0*0000a38 -0*000017c SREL32 \.init\.text\+0x0*0000a88 -0*0000190 SREL32 \.init\.text\+0x0*0000a98 -0*00001a4 SREL32 \.text\+0xf*ffffff8 +0*000001c SREL32 \.init\.text +0*0000034 SREL32 \.init\.text\+0x0*0000050 +0*0000048 SREL32 \.init\.text\+0x0*0000080 +0*000005c SREL32 \.init\.text\+0x0*00000b0 +0*0000080 SREL32 \.init\.text\+0x0*00002c0 +0*00000a0 SREL32 \.init\.text\+0x0*00005a0 +0*00000b8 SREL32 \.init\.text\+0x0*00005f0 +0*00000cc SREL32 \.init\.text\+0x0*0000610 +0*00000e0 SREL32 \.init\.text\+0x0*0000630 +0*00000fc SREL32 \.init\.text\+0x0*0000750 +0*0000120 SREL32 \.init\.text\+0x0*0000990 +0*000013c SREL32 \.init\.text\+0x0*0000a10 +0*0000150 SREL32 \.init\.text\+0x0*0000a20 +0*0000164 SREL32 \.init\.text\+0x0*0000a40 +0*000017c SREL32 \.init\.text\+0x0*0000a90 +0*0000190 SREL32 \.init\.text\+0x0*0000aa0 +0*00001a4 SREL32 \.text diff --git a/gas/testsuite/gas/cfi/cfi-alpha-2.d b/gas/testsuite/gas/cfi/cfi-alpha-2.d new file mode 100644 index 00000000000..4a87da2d9a5 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-alpha-2.d @@ -0,0 +1,9 @@ +#objdump: -r -j .eh_frame +#name: CFI on alpha, 2 + +.*: file format elf64-alpha + +RELOCATION RECORDS FOR \[\.eh_frame\]: +OFFSET TYPE VALUE +0*000001c SREL32 \.text +0*0000030 SREL32 \.text\+0x0*0000004 diff --git a/gas/testsuite/gas/cfi/cfi-alpha-2.s b/gas/testsuite/gas/cfi/cfi-alpha-2.s new file mode 100644 index 00000000000..56b22e811ff --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-alpha-2.s @@ -0,0 +1,14 @@ + .text + .ent foo +foo: + .frame $30, 0, $26, 0 + .prologue 1 + ret + .end foo + + .ent bar +bar: + .frame $30, 0, $26, 0 + .prologue 1 + ret + .end bar diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp index d52803f4dcd..b6acaad6c43 100644 --- a/gas/testsuite/gas/cfi/cfi.exp +++ b/gas/testsuite/gas/cfi/cfi.exp @@ -15,5 +15,6 @@ if { [istarget alpha*-*-*] } then { if $elf { run_dump_test "cfi-alpha-1" + run_dump_test "cfi-alpha-2" } } -- 2.30.2