From 72b4cdc7e2a4616f6e2f462021ca7250156d43d6 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 14 Sep 2015 17:31:27 +0000 Subject: [PATCH] fix inverted setting of sh fdpic flag by binutils the behavior by bfd/ld matched the ABI document but was the opposite of the kernel's interpretation and opposite of how ld treats the flag on every other target using fdpic. see this thread for details: https://sourceware.org/ml/binutils/2015-09/msg00186.html --- patches/binutils-2.25.1/0004-shfdpicflag.diff | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 patches/binutils-2.25.1/0004-shfdpicflag.diff diff --git a/patches/binutils-2.25.1/0004-shfdpicflag.diff b/patches/binutils-2.25.1/0004-shfdpicflag.diff new file mode 100644 index 0000000..4416d25 --- /dev/null +++ b/patches/binutils-2.25.1/0004-shfdpicflag.diff @@ -0,0 +1,21 @@ +diff -ur binutils-2.25.1.orig/bfd/elf32-sh.c binutils-2.25.1/bfd/elf32-sh.c +--- binutils-2.25.1.orig/bfd/elf32-sh.c 2015-09-03 21:52:17.000000000 +0000 ++++ binutils-2.25.1/bfd/elf32-sh.c 2015-09-14 17:08:48.114426847 +0000 +@@ -5487,7 +5487,7 @@ + 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) +@@ -6644,7 +6644,7 @@ + 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))