Fix the SH behavior for EF_SH_PIC flag in FDPIC ABI
authorRich Felker <dalias@libc.org>
Mon, 14 Sep 2015 23:16:27 +0000 (08:16 +0900)
committerKaz Kojima <kkojima@rr.iij4u.or.jp>
Mon, 14 Sep 2015 23:34:12 +0000 (08:34 +0900)
Fix it so that it's compatible with the kernel and other FDPIC targets.

* elf32-sh.c (sh_elf_relocate_section): Set EF_SH_PIC flag
instead of clearing it on cross-section relocations.
(sh_elf_merge_private_data): Clear EF_SH_PIC flag by default.

bfd/ChangeLog
bfd/elf32-sh.c

index 14c68bcce70b9d0a1de00eef6357da10149626d0..2c4a6e05d02aebc9e9db814e6824837ad31261d0 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-14  Rich Felker  <dalias@libc.org>
+
+       * elf32-sh.c (sh_elf_relocate_section): Set EF_SH_PIC flag
+       instead of clearing it on cross-section relocations.
+       (sh_elf_merge_private_data): Clear EF_SH_PIC flag by default.
+
 2015-09-12  Helge Deller  <deller@gmx.de>
 
        PR ld/18514
index 7b8d7636de5fe4ce169eacbeb876ab7d741df798..fdeadd016d59f78db19bacd2d5dff0d07308cd4a 100644 (file)
@@ -5496,7 +5496,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                   input_bfd, input_section, rel->r_offset, symname);
            }
 
-         elf_elfheader (output_bfd)->e_flags &= ~EF_SH_PIC;
+         elf_elfheader (output_bfd)->e_flags |= EF_SH_PIC;
        }
 
       if (r != bfd_reloc_ok)
@@ -6653,7 +6653,7 @@ sh_elf_merge_private_data (bfd *ibfd, bfd *obfd)
       elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
       sh_elf_set_mach_from_flags (obfd);
       if (elf_elfheader (obfd)->e_flags & EF_SH_FDPIC)
-       elf_elfheader (obfd)->e_flags |= EF_SH_PIC;
+       elf_elfheader (obfd)->e_flags &= ~EF_SH_PIC;
     }
 
   if (! sh_merge_bfd_arch (ibfd, obfd))
This page took 0.03122 seconds and 4 git commands to generate.