Check info->executable for symbols which need copy relocs
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Dec 2014 00:57:45 +0000 (16:57 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Dec 2014 00:58:22 +0000 (16:58 -0800)
* elf64-x86-64.c (elf_x86_64_relocate_section): Check
info->executable for symbols which need copy relocs.

bfd/ChangeLog
bfd/elf64-x86-64.c

index 91245b9e4199e5bc0b75ec7d574b81b50c385116..f7caed5a4900c85aa057a3ab5ff5b9e671c88c21 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf64-x86-64.c (elf_x86_64_relocate_section): Check
+       info->executable for symbols which need copy relocs.
+
 2014-12-02  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elf64-x86-64.c (elf_x86_64_check_relocs): Revert the last
index 58db76a79807c0e3fba144683230ab34598199e2..8b0b8bf6a004f901c60851dfb74fa725560274f6 100644 (file)
@@ -4059,7 +4059,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                     defined locally or for a branch.  */
                  fail = !h->def_regular && !branch;
                }
-             else if (!h->needs_copy)
+             else if (!(info->executable && h->needs_copy))
                {
                  /* Symbol doesn't need copy reloc and isn't referenced
                     locally.  We only allow branch to symbol with
@@ -4120,7 +4120,8 @@ direct:
           /* Don't copy a pc-relative relocation into the output file
              if the symbol needs copy reloc.  */
          if ((info->shared
-              && !(h != NULL
+              && !(info->executable
+                   && h != NULL
                    && h->needs_copy
                    && IS_X86_64_PCREL_TYPE (r_type))
               && (h == NULL