From d32d48186c16c29f888546a3afaad3016e434503 Mon Sep 17 00:00:00 2001
From: Simon South <ssouth@simonsouth.com>
Date: Sat, 24 Oct 2015 10:30:26 -0400
Subject: [PATCH 4/4] binutils: ld: Set ELF interpreter to
"/system/runtime_loader"
For x86_64 this includes defining a new linker emulation, "elf_x86_64_haiku"
(to match the existing "elf_i386_haiku") and updating gcc accordingly.
---
binutils/ld/Makefile.in | 5 +++++
binutils/ld/configure.tgt | 4 ++--
binutils/ld/emulparams/armelf_haiku.sh | 2 ++
binutils/ld/emulparams/elf32ppchaiku.sh | 1 +
binutils/ld/emulparams/elf_haiku.sh | 1 +
binutils/ld/emulparams/elf_i386_haiku.sh | 1 +
binutils/ld/emulparams/elf_mipsel_haiku.sh | 1 +
binutils/ld/emulparams/elf_x86_64_haiku.sh | 2 ++
gcc/gcc/config/i386/haiku64.h | 2 +-
9 files changed, 16 insertions(+), 3 deletions(-)
create mode 100644 binutils/ld/emulparams/elf_haiku.sh
create mode 100644 binutils/ld/emulparams/elf_x86_64_haiku.sh
diff --git a/binutils/ld/Makefile.in b/binutils/ld/Makefile.in
index 06744c9..edff373 100644
a
|
b
|
ALL_64_EMULATION_SOURCES = \
|
789 | 789 | eelf_k1om_fbsd.c \ |
790 | 790 | eelf_x86_64.c \ |
791 | 791 | eelf_x86_64_fbsd.c \ |
| 792 | eelf_x86_64_haiku.c \ |
792 | 793 | eelf_x86_64_nacl.c \ |
793 | 794 | eelf_x86_64_sol2.c \ |
794 | 795 | ehppa64linux.c \ |
… |
… |
eelf_x86_64_fbsd.c: $(srcdir)/emulparams/elf_x86_64_fbsd.sh \
|
3376 | 3377 | $(srcdir)/emulparams/elf_x86_64.sh \ |
3377 | 3378 | $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} |
3378 | 3379 | |
| 3380 | eelf_x86_64_haiku.c: $(srcdir)/emulparams/elf_x86_64_haiku.sh \ |
| 3381 | $(srcdir)/emulparams/elf_x86_64.sh \ |
| 3382 | $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} |
| 3383 | |
3379 | 3384 | eelf_x86_64_nacl.c: $(srcdir)/emulparams/elf_x86_64_nacl.sh \ |
3380 | 3385 | $(srcdir)/emulparams/elf_x86_64.sh \ |
3381 | 3386 | $(srcdir)/emulparams/elf_nacl.sh \ |
diff --git a/binutils/ld/configure.tgt b/binutils/ld/configure.tgt
index 94cf5c4..35c7804 100644
a
|
b
|
i[3-7]86-*-interix*) targ_emul=i386pe_posix;
|
338 | 338 | i[3-7]86-*-beospe*) targ_emul=i386beos ;; |
339 | 339 | i[3-7]86-*-beos*) targ_emul=elf_i386_be ;; |
340 | 340 | i[3-7]86-*-haiku*) targ_emul=elf_i386_haiku ;; |
341 | | x86_64-*-haiku*) targ_emul=elf_x86_64 |
342 | | targ_extra_emuls=elf_i386_haiku ;; |
| 341 | x86_64-*-haiku*) targ_emul=elf_x86_64_haiku |
| 342 | targ_extra_emuls="elf_x86_64 elf_i386_haiku" ;; |
343 | 343 | i[3-7]86-*-vxworks*) targ_emul=elf_i386_vxworks ;; |
344 | 344 | i[3-7]86-*-chaos) targ_emul=elf_i386_chaos |
345 | 345 | ;; |
diff --git a/binutils/ld/emulparams/armelf_haiku.sh b/binutils/ld/emulparams/armelf_haiku.sh
index 39b7f65..9dcdf54 100644
a
|
b
|
TARGET2_TYPE=got-rel
|
22 | 22 | |
23 | 23 | # ARM does not support .s* sections. |
24 | 24 | NO_SMALL_DATA=yes |
| 25 | |
| 26 | . ${srcdir}/emulparams/elf_haiku.sh |
diff --git a/binutils/ld/emulparams/elf32ppchaiku.sh b/binutils/ld/emulparams/elf32ppchaiku.sh
index 976880c..547e5c8 100644
a
|
b
|
|
1 | 1 | . ${srcdir}/emulparams/elf32ppc.sh |
| 2 | . ${srcdir}/emulparams/elf_haiku.sh |
2 | 3 | TEXT_START_ADDR=0x200000 |
3 | 4 | MAXPAGESIZE=0x1000 |
4 | 5 | GENERATE_SHLIB_SCRIPT=yes |
diff --git a/binutils/ld/emulparams/elf_haiku.sh b/binutils/ld/emulparams/elf_haiku.sh
new file mode 100644
index 0000000..401eedc
-
|
+
|
|
| 1 | ELF_INTERPRETER_NAME=\"/system/runtime_loader\" |
diff --git a/binutils/ld/emulparams/elf_i386_haiku.sh b/binutils/ld/emulparams/elf_i386_haiku.sh
index 25ca6bc..b70da86 100644
a
|
b
|
NOP=0x90909090
|
9 | 9 | TEMPLATE_NAME=elf32 |
10 | 10 | GENERATE_SHLIB_SCRIPT=yes |
11 | 11 | NO_SMALL_DATA=yes |
| 12 | . ${srcdir}/emulparams/elf_haiku.sh |
diff --git a/binutils/ld/emulparams/elf_mipsel_haiku.sh b/binutils/ld/emulparams/elf_mipsel_haiku.sh
index ff9c325..ab38e23 100644
a
|
b
|
|
1 | 1 | . ${srcdir}/emulparams/elf32lmip.sh |
| 2 | . ${srcdir}/emulparams/elf_haiku.sh |
2 | 3 | |
diff --git a/binutils/ld/emulparams/elf_x86_64_haiku.sh b/binutils/ld/emulparams/elf_x86_64_haiku.sh
new file mode 100644
index 0000000..f049559
-
|
+
|
|
| 1 | . ${srcdir}/emulparams/elf_x86_64.sh |
| 2 | . ${srcdir}/emulparams/elf_haiku.sh |
diff --git a/gcc/gcc/config/i386/haiku64.h b/gcc/gcc/config/i386/haiku64.h
index c225cdc..1a63749 100644
a
|
b
|
Boston, MA 02111-1307, USA. */
|
65 | 65 | |
66 | 66 | #undef LINK_SPEC |
67 | 67 | #define LINK_SPEC \ |
68 | | "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386_haiku} \ |
| 68 | "%{" SPEC_64 ":-m elf_x86_64_haiku} %{" SPEC_32 ":-m elf_i386_haiku} \ |
69 | 69 | %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \ |
70 | 70 | :-pie --allow-shlib-undefined --export-dynamic} %{shared:-shared} \ |
71 | 71 | %{nostart|shared:-e 0;:-no-undefined}" |