* dw2gencfi.c (output_fde): Use fix_new to emit pc-relative reloc.
authorRichard Henderson <rth@redhat.com>
Sat, 31 May 2003 19:36:45 +0000 (19:36 +0000)
committerRichard Henderson <rth@redhat.com>
Sat, 31 May 2003 19:36:45 +0000 (19:36 +0000)
        (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
gas/dw2gencfi.c
gas/testsuite/ChangeLog
gas/testsuite/gas/alpha/elf-reloc-8.d
gas/testsuite/gas/cfi/cfi-alpha-2.d [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi-alpha-2.s [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi.exp

index fc7d3fdbc0346f2bb212c46fc19c025248ecff2f..34e844bbfffbe0d03cbcb677c77b81cc46493a28 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-31  Richard Henderson  <rth@redhat.com>
+
+       * 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  <rth@redhat.com>
 
        * config/tc-alpha.c (alpha_cur_ent_sym): Remove.
index 2239578139359e61658873b860db7e16979f19cb..ee67027ec53fe56dd0e5394d41dad7d7d44b4fe3 100644 (file)
@@ -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;
 }
index 11f87453c4b8c40f541910595f4f170f25c341f6..82cef6c7cfcb4c4b66361badf787ba3852313a0f 100644 (file)
@@ -1,3 +1,10 @@
+2003-05-31  Richard Henderson  <rth@redhat.com>
+
+       * 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  <rth@redhat.com>
 
        * gas/alpha/elf-reloc-8.d: Add .eh_frame relocs.
index de5e0e88595d1b5cc29f261f98f0b161a538f3d2..68f5678eb11a23391d9bd9e6af2703d006b64755 100644 (file)
@@ -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 (file)
index 0000000..4a87da2
--- /dev/null
@@ -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 (file)
index 0000000..56b22e8
--- /dev/null
@@ -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
index d52803f4dcd7b955b3b33c146f12737a8c87c260..b6acaad6c433fdd0fbfdb2d080c41e8e451c1a60 100644 (file)
@@ -15,5 +15,6 @@ if { [istarget alpha*-*-*] } then {
 
     if $elf {
        run_dump_test "cfi-alpha-1"
+       run_dump_test "cfi-alpha-2"
     }
 }