Ticket #12430: 0004-binutils-ld-Set-ELF-interpreter-to-system-runtime_lo.patch

File 0004-binutils-ld-Set-ELF-interpreter-to-system-runtime_lo.patch, 4.9 KB (added by simonsouth, 9 years ago)

Set ELF interpreter to "/system/runtime_loader"

  • binutils/ld/Makefile.in

    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 = \  
    789789    eelf_k1om_fbsd.c \
    790790    eelf_x86_64.c \
    791791    eelf_x86_64_fbsd.c \
     792    eelf_x86_64_haiku.c \
    792793    eelf_x86_64_nacl.c \
    793794    eelf_x86_64_sol2.c \
    794795    ehppa64linux.c \
    eelf_x86_64_fbsd.c: $(srcdir)/emulparams/elf_x86_64_fbsd.sh \  
    33763377  $(srcdir)/emulparams/elf_x86_64.sh \
    33773378  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
    33783379
     3380eelf_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
    33793384eelf_x86_64_nacl.c: $(srcdir)/emulparams/elf_x86_64_nacl.sh \
    33803385  $(srcdir)/emulparams/elf_x86_64.sh \
    33813386  $(srcdir)/emulparams/elf_nacl.sh \
  • binutils/ld/configure.tgt

    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;  
    338338i[3-7]86-*-beospe*) targ_emul=i386beos ;;
    339339i[3-7]86-*-beos*)   targ_emul=elf_i386_be ;;
    340340i[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 ;;
     341x86_64-*-haiku*)    targ_emul=elf_x86_64_haiku
     342            targ_extra_emuls="elf_x86_64 elf_i386_haiku" ;;
    343343i[3-7]86-*-vxworks*)    targ_emul=elf_i386_vxworks ;;
    344344i[3-7]86-*-chaos)   targ_emul=elf_i386_chaos
    345345            ;;
  • binutils/ld/emulparams/armelf_haiku.sh

    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  
    2222
    2323# ARM does not support .s* sections.
    2424NO_SMALL_DATA=yes
     25
     26. ${srcdir}/emulparams/elf_haiku.sh
  • binutils/ld/emulparams/elf32ppchaiku.sh

    diff --git a/binutils/ld/emulparams/elf32ppchaiku.sh b/binutils/ld/emulparams/elf32ppchaiku.sh
    index 976880c..547e5c8 100644
    a b  
    11. ${srcdir}/emulparams/elf32ppc.sh
     2. ${srcdir}/emulparams/elf_haiku.sh
    23TEXT_START_ADDR=0x200000
    34MAXPAGESIZE=0x1000
    45GENERATE_SHLIB_SCRIPT=yes
  • new file inutils/ld/emulparams/elf_haiku.sh

    diff --git a/binutils/ld/emulparams/elf_haiku.sh b/binutils/ld/emulparams/elf_haiku.sh
    new file mode 100644
    index 0000000..401eedc
    - +  
     1ELF_INTERPRETER_NAME=\"/system/runtime_loader\"
  • binutils/ld/emulparams/elf_i386_haiku.sh

    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  
    99TEMPLATE_NAME=elf32
    1010GENERATE_SHLIB_SCRIPT=yes
    1111NO_SMALL_DATA=yes
     12. ${srcdir}/emulparams/elf_haiku.sh
  • binutils/ld/emulparams/elf_mipsel_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  
    11. ${srcdir}/emulparams/elf32lmip.sh
     2. ${srcdir}/emulparams/elf_haiku.sh
    23
  • new file inutils/ld/emulparams/elf_x86_64_haiku.sh

    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
  • gcc/gcc/config/i386/haiku64.h

    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. */  
    6565
    6666#undef  LINK_SPEC
    6767#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} \
    6969   %{shared|r|pie|fno-pic|fno-PIC|fno-pie|fno-PIE:; \
    7070   :-pie --allow-shlib-undefined --export-dynamic} %{shared:-shared} \
    7171   %{nostart|shared:-e 0;:-no-undefined}"