bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 21 Sep 2009 18:55:08 +0000 (18:55 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Mon, 21 Sep 2009 18:55:08 +0000 (18:55 +0000)
* elf-eh-frame.c (make_pc_relative): New function.
(_bfd_elf_write_section_eh_frame): Use it.

ld/testsuite/
* ld-mips-elf/eh-frame1-n32.d: Expect PC-relative encodings
to include DW_EH_PE_sdata4.
* ld-mips-elf/eh-frame2-n32.d: Likewise.
* ld-mips-elf/eh-frame1-n64.d: Expect PC-relative encodings
to include DW_EH_PE_sdata8.
* ld-mips-elf/eh-frame2-n64.d: Likewise.

bfd/ChangeLog
bfd/elf-eh-frame.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/eh-frame1-n32.d
ld/testsuite/ld-mips-elf/eh-frame1-n64.d
ld/testsuite/ld-mips-elf/eh-frame2-n32.d
ld/testsuite/ld-mips-elf/eh-frame2-n64.d

index 9900119f37baadee64803878a5fc2bc257102d76..a5fe823aeb4a21aca0966d3a3d43041d7cc98708 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-21  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * elf-eh-frame.c (make_pc_relative): New function.
+       (_bfd_elf_write_section_eh_frame): Use it.
+
 2009-09-21  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define.
index 4ea96273426f706d20e6f9c13259fdb8ab0f5b2d..995dac04ee0649596ed430a476a470936fd9d6af 100644 (file)
@@ -423,6 +423,28 @@ skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width,
   return last;
 }
 
+/* Convert absolute encoding ENCODING into PC-relative form.
+   SIZE is the size of a pointer.  */
+
+static unsigned char
+make_pc_relative (unsigned char encoding, unsigned int ptr_size)
+{
+  if ((encoding & 0x7f) == DW_EH_PE_absptr)
+    switch (ptr_size)
+      {
+      case 2:
+       encoding |= DW_EH_PE_sdata2;
+       break;
+      case 4:
+       encoding |= DW_EH_PE_sdata4;
+       break;
+      case 8:
+       encoding |= DW_EH_PE_sdata8;
+       break;
+      }
+  return encoding | DW_EH_PE_pcrel;
+}
+
 /* Called before calling _bfd_elf_parse_eh_frame on every input bfd's
    .eh_frame section.  */
 
@@ -1454,7 +1476,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
                {
                  BFD_ASSERT (action & 1);
                  *aug++ = 'R';
-                 *buf++ = DW_EH_PE_pcrel;
+                 *buf++ = make_pc_relative (DW_EH_PE_absptr, ptr_size);
                  action &= ~1;
                }
 
@@ -1465,7 +1487,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
                    if (action & 2)
                      {
                        BFD_ASSERT (*buf == ent->lsda_encoding);
-                       *buf |= DW_EH_PE_pcrel;
+                       *buf = make_pc_relative (*buf, ptr_size);
                        action &= ~2;
                      }
                    buf++;
@@ -1506,7 +1528,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
                    if (action & 1)
                      {
                        BFD_ASSERT (*buf == ent->fde_encoding);
-                       *buf |= DW_EH_PE_pcrel;
+                       *buf = make_pc_relative (*buf, ptr_size);
                        action &= ~1;
                      }
                    buf++;
index 3185e3b2179018f5f723f07b52a1548f5809bdb6..7049206076a46c2576c30894280681118abbb2f1 100644 (file)
@@ -1,3 +1,12 @@
+2009-09-21  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * ld-mips-elf/eh-frame1-n32.d: Expect PC-relative encodings
+       to include DW_EH_PE_sdata4.
+       * ld-mips-elf/eh-frame2-n32.d: Likewise.
+       * ld-mips-elf/eh-frame1-n64.d: Expect PC-relative encodings
+       to include DW_EH_PE_sdata8.
+       * ld-mips-elf/eh-frame2-n64.d: Likewise.
+
 2009-09-21  Alan Modra  <amodra@bigpond.net.au>
 
        * ld-powerpc/tlslib.s: Delete dot-symbol entry syms.  Add
index e718379d3618337d330d54360cfffa2de8f3efd0..a460512a978757d4c2faa2268904244f83b5123f 100644 (file)
@@ -25,7 +25,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10
+  Augmentation data:     1b
 
   DW_CFA_advance_loc: 0 to 00000000
   DW_CFA_advance_loc: 0 to 00000000
@@ -65,7 +65,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10 00 00 00 00 00
+  Augmentation data:     1b 00 00 00 00 00
 
   DW_CFA_advance_loc: 0 to 00000000
   DW_CFA_advance_loc: 0 to 00000000
@@ -108,7 +108,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     00 00 00 00 00 10
+  Augmentation data:     00 00 00 00 00 1b
 
   DW_CFA_advance_loc: 0 to 00000000
 
index 2913106c28967ce1cd7ed5c6d9da71d75be5ab4e..c77315f9cb44a9e1ae56d9265cc60f70926045a7 100644 (file)
@@ -41,7 +41,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10
+  Augmentation data:     1c
 
   DW_CFA_advance_loc: 0 to 00000000
   DW_CFA_advance_loc: 0 to 00000000
@@ -105,7 +105,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10 00 00 00 00 00 00 00 00 00
+  Augmentation data:     1c 00 00 00 00 00 00 00 00 00
 
   DW_CFA_advance_loc: 0 to 00000000
   DW_CFA_advance_loc: 0 to 00000000
@@ -172,7 +172,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     00 00 00 00 00 00 00 00 00 10
+  Augmentation data:     00 00 00 00 00 00 00 00 00 1c
 
   DW_CFA_advance_loc: 0 to 00000000
   DW_CFA_advance_loc: 0 to 00000000
index e029420b8ecf89920408edb9e215916a997e74ba..e2649559153b171e84c89e1d0063b056f1286555 100644 (file)
@@ -25,7 +25,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10
+  Augmentation data:     1b
 
   DW_CFA_nop
   DW_CFA_nop
@@ -65,7 +65,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10 00 00 00 00 00
+  Augmentation data:     1b 00 00 00 00 00
 
   DW_CFA_nop
 
@@ -104,7 +104,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     00 00 00 00 00 10
+  Augmentation data:     00 00 00 00 00 1b
 
   DW_CFA_nop
 
index a03476ee11252a7a2243f77bff213616452c435e..237c3d46f9ca682de16ebeab780b49e953bc3877 100644 (file)
@@ -41,7 +41,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10
+  Augmentation data:     1c
 
   DW_CFA_nop
   DW_CFA_nop
@@ -105,7 +105,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     10 00 00 00 00 00 00 00 00 00
+  Augmentation data:     1c 00 00 00 00 00 00 00 00 00
 
   DW_CFA_nop
   DW_CFA_nop
@@ -164,7 +164,7 @@ Contents of the \.eh_frame section:
   Code alignment factor: 1
   Data alignment factor: 4
   Return address column: 31
-  Augmentation data:     00 00 00 00 00 00 00 00 00 10
+  Augmentation data:     00 00 00 00 00 00 00 00 00 1c
 
   DW_CFA_nop
   DW_CFA_nop
This page took 0.033439 seconds and 4 git commands to generate.