add initial fdpic support

binutils-2.25.1/0003-shemuls.diff is needed to include the existing
fdpic support in the build when targeting sh*-linux-* rather than
tucking it away under sh*-uclinux-* only

gcc-5.2.0/0007-fdpic.diff is based on the original abandoned fdpic
patch 3/3 sent to the gcc list in 2010, updated for modern gcc and
with the uclinux dependencies removed. the original is here:

  https://gcc.gnu.org/ml/gcc-patches/2010-08/msg01464.html

gcc-5.2.0/0001-musl.diff has been updated to use the right musl
dynamic linker pathname for fdpic so that musl-specific changes can be
avoided in the main fdpic patch.

at present, additional patches to musl are needed to produce working
binaries for the target.
This commit is contained in:
Rich Felker 2015-09-11 17:27:35 +00:00
parent 532e13f3f7
commit 3a0c9775b6
3 changed files with 1984 additions and 2 deletions

View File

@ -0,0 +1,48 @@
diff -ur ../baseline/binutils-2.25.1/bfd/config.bfd binutils-2.25.1/bfd/config.bfd
--- ../baseline/binutils-2.25.1/bfd/config.bfd 2014-10-14 07:32:02.000000000 +0000
+++ binutils-2.25.1/bfd/config.bfd 2015-09-04 19:24:08.678337083 +0000
@@ -1370,6 +1370,7 @@
sh-*-linux*)
targ_defvec=sh_elf32_linux_be_vec
targ_selvecs="sh_elf32_linux_vec sh64_elf32_linux_vec sh64_elf32_linux_be_vec sh64_elf64_linux_vec sh64_elf64_linux_be_vec"
+ targ_selvecs="${targ_selvecs} sh_elf32_vec sh_elf32_le_vec sh_elf32_fdpic_le_vec sh_elf32_fdpic_be_vec"
want64=true
;;
#endif /* BFD64 */
@@ -1377,10 +1378,12 @@
sh*eb-*-linux*)
targ_defvec=sh_elf32_linux_be_vec
targ_selvecs=sh_elf32_linux_vec
+ targ_selvecs="${targ_selvecs} sh_elf32_vec sh_elf32_le_vec sh_elf32_fdpic_le_vec sh_elf32_fdpic_be_vec"
;;
sh*-*-linux*)
targ_defvec=sh_elf32_linux_vec
targ_selvecs=sh_elf32_linux_be_vec
+ targ_selvecs="${targ_selvecs} sh_elf32_vec sh_elf32_le_vec sh_elf32_fdpic_le_vec sh_elf32_fdpic_be_vec"
;;
sh-*-uclinux* | sh[12]-*-uclinux*)
diff -ur ../baseline/binutils-2.25.1/ld/configure.tgt binutils-2.25.1/ld/configure.tgt
--- ../baseline/binutils-2.25.1/ld/configure.tgt 2014-10-14 07:32:04.000000000 +0000
+++ binutils-2.25.1/ld/configure.tgt 2015-09-04 19:22:05.151677949 +0000
@@ -623,15 +623,17 @@
score-*-elf) targ_emul=score7_elf
targ_extra_emuls=score3_elf ;;
sh-*-linux*) targ_emul=shlelf_linux
- targ_extra_emuls=shelf_linux
+ targ_extra_emuls="shelf_linux shlelf_fd shelf_fd shlelf shelf"
targ_extra_libpath=shelf_linux ;;
sh64eb-*-linux*) targ_emul=shelf32_linux
targ_extra_emuls="shlelf32_linux" ;;
sh64-*-linux*) targ_emul=shlelf32_linux
targ_extra_emuls="shelf32_linux"
targ_extra_libpath=shelf32_linux ;;
-sh*eb-*-linux*) targ_emul=shelf_linux ;;
-sh*-*-linux*) targ_emul=shlelf_linux ;;
+sh*eb-*-linux*) targ_emul=shelf_linux
+ targ_extra_emuls="shelf_fd shelf" ;;
+sh*-*-linux*) targ_emul=shlelf_linux
+ targ_extra_emuls="shlelf_fd shlelf" ;;
sh5le-*-netbsd*) targ_emul=shlelf32_nbsd
targ_extra_emuls="shelf32_nbsd shelf64_nbsd shlelf64_nbsd shelf_nbsd shlelf_nbsd" ;;
sh5-*-netbsd*) targ_emul=shelf32_nbsd

View File

@ -598,7 +598,7 @@ diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
index 0f5d614..4c167c6 100644
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -43,6 +43,28 @@ along with GCC; see the file COPYING3. If not see
@@ -43,6 +43,29 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
@ -622,7 +622,8 @@ index 0f5d614..4c167c6 100644
+
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER \
+ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP ".so.1"
+ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
+ "%{mfdpic:-fdpic}.so.1"
+
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"

File diff suppressed because it is too large Load Diff