Force relocs emited for an executable to contain virtual addresses.
authorNick Clifton <nickc@redhat.com>
Thu, 18 May 2000 17:12:31 +0000 (17:12 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 18 May 2000 17:12:31 +0000 (17:12 +0000)
bfd/ChangeLog
bfd/elflink.h

index f386002ff6af3afaaf0956d42d94b0aa65cab273..795ba54ded86cfda9be56b5dc5423a333c4300eb 100644 (file)
@@ -1,3 +1,8 @@
+2000-05-18  Momchil Velikov <velco@fadata.bg>
+
+       * elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting
+       relocs for an executable, ensure that they are virtual addresses.
+
 Thu May 18 10:55:47 2000  Jeffrey A Law  (law@cygnus.com)
 
        * config.bfd (hppa*64*-*-hpux11*): New target triplet.
index 749d13981c96e0e3f978064dbee5ad0f8c253537..5d86bbc5338ee457aa81d6f5519cdaa078b72133 100644 (file)
@@ -4323,7 +4323,7 @@ elf_bfd_final_link (abfd, info)
          if (o != NULL)
            o->target_index = bfd_get_symcount (abfd);
          elfsym.st_shndx = i;
-         if (info->relocateable || info->emitrelocations || o == NULL)
+         if (info->relocateable || o == NULL)
            elfsym.st_value = 0;
          else
            elfsym.st_value = o->vma;
@@ -5514,6 +5514,10 @@ elf_link_input_bfd (finfo, input_bfd)
 
                  irela->r_offset += o->output_offset;
 
+                 /* Relocs in an executable have to be virtual addresses.  */
+                 if (finfo->info->emitrelocations)
+                   irela->r_offset += o->output_section->vma;
+
                  r_symndx = ELF_R_SYM (irela->r_info);
 
                  if (r_symndx == 0)