aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRich Felker <dalias@libc.org>2015-09-15 08:16:27 +0900
committerKaz Kojima <kkojima@rr.iij4u.or.jp>2015-09-15 08:34:12 +0900
commitfbedb42d07cdc97a5bc698d1f7732ee776763cbc (patch)
tree8b8e9d6b6b6edb015b5568ada2d21bed12264c0d /bfd
parent4c2f2a792a5971fcc7fe6511725eaf50d19d302b (diff)
downloadgdb-fbedb42d07cdc97a5bc698d1f7732ee776763cbc.zip
gdb-fbedb42d07cdc97a5bc698d1f7732ee776763cbc.tar.gz
gdb-fbedb42d07cdc97a5bc698d1f7732ee776763cbc.tar.bz2
Fix the SH behavior for EF_SH_PIC flag in FDPIC ABI
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-sh.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 14c68bc..2c4a6e0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 7b8d763..fdeadd0 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -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))