Restore R_386_IRELATIVE and R_X86_64_IRELATIVE
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 9 Mar 2012 16:28:38 +0000 (16:28 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 9 Mar 2012 16:28:38 +0000 (16:28 +0000)
bfd/

2012-03-09  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/13817
* bfd/elf32-i386.c (elf_i386_relocate_section): Restore
R_386_IRELATIVE.

* * elf64-x86-64.c (elf_x86_64_relocate_section): Restore
R_X86_64_IRELATIVE.

ld/testsuite/

2012-03-09  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/13817
* ld-i386/pr13302.d: Updated.
* ld-x86-64/pr13082-5b.d: Likewise.
* ld-x86-64/pr13082-6a.d: Likewise.
* ld-x86-64/pr13082-6b.d: Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-i386/pr13302.d
ld/testsuite/ld-x86-64/pr13082-5b.d
ld/testsuite/ld-x86-64/pr13082-6a.d
ld/testsuite/ld-x86-64/pr13082-6b.d

index 21402408d6dac97349ab95c2d476c9a1b5ebe5bf..66a7339b6f7a71758dbf69398b7a0dbc76140709 100644 (file)
@@ -1,3 +1,12 @@
+2012-03-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/13817
+       * bfd/elf32-i386.c (elf_i386_relocate_section): Restore
+       R_386_IRELATIVE.
+
+       * * elf64-x86-64.c (elf_x86_64_relocate_section): Restore
+       R_X86_64_IRELATIVE.
+
 2012-03-08  Tristan Gingold  <gingold@adacore.com>
 
        * vms-lib.c (_bfd_vms_lib_write_archive_contents): Set maximum
index d1873051b4d9bc692b86b23b6277e3718f00864f..01c06695956ad0c3714a60b6e6f156f2ed3f475e 100644 (file)
@@ -3257,7 +3257,6 @@ elf_i386_relocate_section (bfd *output_bfd,
                  bfd_byte *loc;
                  asection *sreloc;
                  bfd_vma offset;
-                 bfd_boolean relocate;
 
                  /* Need a dynamic relocation to get the real function
                     adddress.  */
@@ -3278,14 +3277,15 @@ elf_i386_relocate_section (bfd *output_bfd,
                      || info->executable)
                    {
                      /* This symbol is resolved locally.  */
-                     outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
-                     relocate = TRUE;
+                     outrel.r_info = ELF32_R_INFO (0, R_386_IRELATIVE);
+                     bfd_put_32 (output_bfd,
+                                 (h->root.u.def.value
+                                  + h->root.u.def.section->output_section->vma
+                                  + h->root.u.def.section->output_offset),
+                                 contents + offset);
                    }
                  else
-                   {
-                     outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
-                     relocate = FALSE;
-                   }
+                   outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
 
                  sreloc = htab->elf.irelifunc;
                  loc = sreloc->contents;
@@ -3298,8 +3298,7 @@ elf_i386_relocate_section (bfd *output_bfd,
                     we need to include the symbol value so that it
                     becomes an addend for the dynamic reloc.  For an
                     internal symbol, we have updated addend.  */
-                 if (! relocate)
-                   continue;
+                 continue;
                }
              /* FALLTHROUGH */
            case R_386_PC32:
index 81ed8660a248dd505d2207ee4737e72bc2c70932..47f12952d7ce3069de51efb5c4f60312a123b768 100644 (file)
@@ -3156,7 +3156,6 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                {
                  Elf_Internal_Rela outrel;
                  asection *sreloc;
-                 bfd_boolean relocate;
 
                  /* Need a dynamic relocation to get the real function
                     address.  */
@@ -3176,15 +3175,15 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                      || info->executable)
                    {
                      /* This symbol is resolved locally.  */
-                     outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE);
-                     outrel.r_addend = relocation;
-                     relocate = TRUE;
+                     outrel.r_info = htab->r_info (0, R_X86_64_IRELATIVE);
+                     outrel.r_addend = (h->root.u.def.value
+                                        + h->root.u.def.section->output_section->vma
+                                        + h->root.u.def.section->output_offset);
                    }
                  else
                    {
                      outrel.r_info = htab->r_info (h->dynindx, r_type);
                      outrel.r_addend = 0;
-                     relocate = FALSE;
                    }
 
                  sreloc = htab->elf.irelifunc;
@@ -3195,8 +3194,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                     we need to include the symbol value so that it
                     becomes an addend for the dynamic reloc.  For an
                     internal symbol, we have updated addend.  */
-                 if (! relocate)
-                   continue;
+                 continue;
                }
              /* FALLTHROUGH */
            case R_X86_64_PC32:
index b49cce5c2efe6c18a5a8690da47f21d8c11b505f..1e3c5c13848201572fbaacc7a2b9d8c060009ec1 100644 (file)
@@ -1,3 +1,11 @@
+2012-03-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/13817
+       * ld-i386/pr13302.d: Updated.
+       * ld-x86-64/pr13082-5b.d: Likewise.
+       * ld-x86-64/pr13082-6a.d: Likewise.
+       * ld-x86-64/pr13082-6b.d: Likewise.
+
 2012-03-06  Alan Modra  <amodra@gmail.com>
 
        PR ld/13683
index 3d85d085d7936def244a288dbf781ab8f4297464..35c09ae0de24d0b0820e19f02cec6c97785526b7 100644 (file)
@@ -5,7 +5,7 @@
 
 Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name
-[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+[0-9a-f]+ +[0-9a-f]+ +R_386_IRELATIVE +
 
 Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name
index 48e37c3eedc93d0ea108d911296c58c43234cfc9..1c5a5e79b536b97da25444e98f4e0e394d6eecab 100644 (file)
@@ -6,7 +6,7 @@
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
-[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
 
 Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
index de90bb85e9929b38e1c874262bbbecac3f650746..9a1a6551853fcff556283701c3e2bb7f9a3353b0 100644 (file)
@@ -6,7 +6,7 @@
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
-[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
 
 Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
index 66ff59b01495a118b53eacc9de1ed2f80e398559..792c3483eba3406a71fb2ecaa253fc70375fc206 100644 (file)
@@ -6,7 +6,7 @@
 
 Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
-[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_IRELATIVE +[0-9a-f]+
 
 Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
  Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend