Replace IRELATIVE relocations with RELATIVE in .rel.dyn.
[deliverable/binutils-gdb.git] / bfd / elf64-x86-64.c
index 645e5a24348605678d88fbb912a067698f1913a3..2206dd4754b72f55a60bd7c12ccff5fc3af5bbb2 100644 (file)
@@ -3161,6 +3161,7 @@ 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.  */
@@ -3180,15 +3181,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_IRELATIVE);
-                     outrel.r_addend = (h->root.u.def.value
-                                        + h->root.u.def.section->output_section->vma
-                                        + h->root.u.def.section->output_offset);
+                     outrel.r_info = htab->r_info (0, R_X86_64_RELATIVE);
+                     outrel.r_addend = relocation;
+                     relocate = FALSE;
                    }
                  else
                    {
                      outrel.r_info = htab->r_info (h->dynindx, r_type);
                      outrel.r_addend = 0;
+                     relocate = FALSE;
                    }
 
                  sreloc = htab->elf.irelifunc;
@@ -3199,7 +3200,8 @@ 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.  */
-                 continue;
+                 if (! relocate)
+                   continue;
                }
              /* FALLTHROUGH */
            case R_X86_64_PC32:
This page took 0.023963 seconds and 4 git commands to generate.