[haiku-commits] buildtools: btrev43153 - gcc/gcc/config/aarch64 gcc/libgcc/config/aarch64 binutils/ld/emulparams binutils/ld gcc

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 31 Aug 2019 23:06:26 -0400 (EDT)

btrev43153 adds 2 changesets to branch 'master'
old head: 18e01e2af6dd1a4145d91f47cc1d658a36b0bd56
new head: e4426fc38a49e3b9f8ef350663717a8caef4d6c8
overview: 
https://git.haiku-os.org/buildtools/log/?qt=range&q=e4426fc38a49+%5E18e01e2af6dd

----------------------------------------------------------------------------

e97614541b06: binutils: Add support for Haiku ARM64 target
  
  Signed-off-by: Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
  Change-Id: Iebbfba7285429bded988ed0f80a574c471fa9f7d
  Reviewed-on: https://review.haiku-os.org/c/buildtools/+/1796
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

e4426fc38a49: gcc: Add initial support for AArch64 Haiku
  
  Signed-off-by: Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
  Change-Id: I8bd362b61ded01ae1b15d0a999d0db947204aeb7
  Reviewed-on: https://review.haiku-os.org/c/buildtools/+/1797
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                   [ Jaroslaw Pelczar <jarek@xxxxxxxxxxxx> ]

----------------------------------------------------------------------------

10 files changed, 249 insertions(+), 9 deletions(-)
binutils/bfd/config.bfd                  |  5 ++
binutils/ld/Makefile.am                  |  5 ++
binutils/ld/Makefile.in                  | 31 ++++++---
binutils/ld/configure.tgt                |  2 +
binutils/ld/emulparams/aarch64haiku.sh   | 39 ++++++++++++
gcc/gcc/config.gcc                       |  5 ++
gcc/gcc/config/aarch64/aarch64-haiku.h   | 94 ++++++++++++++++++++++++++++
gcc/gcc/config/aarch64/t-aarch64-haiku   | 21 +++++++
gcc/libgcc/config.host                   |  5 ++
gcc/libgcc/config/aarch64/haiku-unwind.h | 51 +++++++++++++++

############################################################################

Commit:      e97614541b06f8d188c98c790435f42fd974999b
URL:         https://git.haiku-os.org/buildtools/commit/?id=e97614541b06
Author:      Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
Date:        Fri Aug 30 16:31:20 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun Sep  1 03:06:22 2019 UTC

binutils: Add support for Haiku ARM64 target

Signed-off-by: Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
Change-Id: Iebbfba7285429bded988ed0f80a574c471fa9f7d
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/1796
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/binutils/bfd/config.bfd b/binutils/bfd/config.bfd
index bc35bf53bd..3d090714f4 100644
--- a/binutils/bfd/config.bfd
+++ b/binutils/bfd/config.bfd
@@ -255,6 +255,11 @@ case "${targ}" in
     targ_selvecs=aarch64_elf64_be_cloudabi_vec
     want64=true
     ;;
+  aarch64-*-haiku*)
+    targ_defvec=aarch64_elf64_le_vec
+    targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec 
aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
+    want64=true
+    ;;
   aarch64-*-linux*)
     targ_defvec=aarch64_elf64_le_vec
     targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec 
aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
diff --git a/binutils/ld/Makefile.am b/binutils/ld/Makefile.am
index fd4907e301..cf48c835e4 100644
--- a/binutils/ld/Makefile.am
+++ b/binutils/ld/Makefile.am
@@ -398,6 +398,7 @@ ALL_64_EMULATION_SOURCES = \
        eaarch64cloudabib.c \
        eaarch64fbsd.c \
        eaarch64fbsdb.c \
+       eaarch64haiku.c \
        eaarch64linux.c \
        eaarch64linuxb.c \
        eaarch64linux32.c \
@@ -1561,6 +1562,10 @@ eaarch64fbsdb.c: $(srcdir)/emulparams/aarch64fbsdb.sh 
$(srcdir)/emulparams/aarch
   $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eaarch64haiku.c: $(srcdir)/emulparams/aarch64haiku.sh \
+  $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
 eaarch64linux.c: $(srcdir)/emulparams/aarch64linux.sh \
   $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git a/binutils/ld/Makefile.in b/binutils/ld/Makefile.in
index 6b3b7cbef4..6806df13b0 100644
--- a/binutils/ld/Makefile.in
+++ b/binutils/ld/Makefile.in
@@ -521,6 +521,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -749,8 +750,8 @@ ALL_EMULATION_SOURCES = \
        eelf32or1k_linux.c \
        eelf32ppc.c \
        eelf32ppc_fbsd.c \
-       eelf32ppchaiku.c \
        eelf32ppclinux.c \
+       eelf32ppchaiku.c \
        eelf32ppcnto.c \
        eelf32ppcsim.c \
        eelf32ppcvxworks.c \
@@ -779,6 +780,7 @@ ALL_EMULATION_SOURCES = \
        eelf_i386_nacl.c \
        eelf_i386_sol2.c \
        eelf_i386_vxworks.c \
+       eelf_mipsel_haiku.c \
        eelf_iamcu.c \
        eelf_s390.c \
        eh8300elf.c \
@@ -882,6 +884,7 @@ ALL_64_EMULATION_SOURCES = \
        eaarch64cloudabib.c \
        eaarch64fbsd.c \
        eaarch64fbsdb.c \
+       eaarch64haiku.c \
        eaarch64linux.c \
        eaarch64linuxb.c \
        eaarch64linux32.c \
@@ -943,8 +946,8 @@ ALL_64_EMULATION_SOURCES = \
        eelf_k1om_fbsd.c \
        eelf_x86_64.c \
        eelf_x86_64_cloudabi.c \
-       eelf_x86_64_fbsd.c \
        eelf_x86_64_haiku.c \
+       eelf_x86_64_fbsd.c \
        eelf_x86_64_nacl.c \
        eelf_x86_64_sol2.c \
        ehppa64linux.c \
@@ -1203,6 +1206,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsdb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32b.Po@am__quote@
@@ -1224,6 +1228,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fuchsia.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/earmelf_linux_eabi.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/earmelf_linux_fdpiceabi.Po@am__quote@
@@ -1342,6 +1347,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32or1k_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppc_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppchaiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppclinux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppcnto.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ppcsim.Po@am__quote@
@@ -1390,6 +1396,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_chaos.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_ldso.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_nacl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@
@@ -1399,10 +1406,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_k1om_fbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_l1om.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_l1om_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_nacl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Po@am__quote@
@@ -2933,13 +2942,13 @@ eelf_i386_sol2.c: $(srcdir)/emulparams/elf_i386_sol2.sh 
\
   $(srcdir)/emultempl/solaris2.em \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eelf_mipsel_haiku.c: $(srcdir)/emulparams/elf_mipsel_haiku.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
 eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
   $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
-eelf_mipsel_haiku.c:  $(srcdir)/emulparams/elf_mipsel_haiku.sh \
-  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-
 eelf_iamcu.c: $(srcdir)/emulparams/elf_iamcu.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
@@ -3164,6 +3173,10 @@ eaarch64fbsdb.c: $(srcdir)/emulparams/aarch64fbsdb.sh 
$(srcdir)/emulparams/aarch
   $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eaarch64haiku.c: $(srcdir)/emulparams/aarch64haiku.sh \
+  $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
 eaarch64linux.c: $(srcdir)/emulparams/aarch64linux.sh \
   $(ELF_DEPS) $(srcdir)/emultempl/aarch64elf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -3321,6 +3334,10 @@ ez8002.c: $(srcdir)/emulparams/z8002.sh \
 eelf32_x86_64.c: $(srcdir)/emulparams/elf32_x86_64.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
+eelf_x86_64_haiku.c: $(srcdir)/emulparams/elf_x86_64_haiku.sh \
+  $(srcdir)/emulparams/elf_x86_64.sh \
+  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
 eelf32_x86_64_nacl.c: $(srcdir)/emulparams/elf32_x86_64_nacl.sh \
   $(srcdir)/emulparams/elf32_x86_64.sh \
   $(srcdir)/emulparams/elf_nacl.sh \
@@ -3481,10 +3498,6 @@ eelf_x86_64_fbsd.c: 
$(srcdir)/emulparams/elf_x86_64_fbsd.sh \
   $(srcdir)/emulparams/elf_x86_64.sh \
   $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 
-eelf_x86_64_haiku.c: $(srcdir)/emulparams/elf_x86_64_haiku.sh \
-  $(srcdir)/emulparams/elf_x86_64.sh \
-  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
-
 eelf_x86_64_nacl.c: $(srcdir)/emulparams/elf_x86_64_nacl.sh \
   $(srcdir)/emulparams/elf_x86_64.sh \
   $(srcdir)/emulparams/elf_nacl.sh \
diff --git a/binutils/ld/configure.tgt b/binutils/ld/configure.tgt
index 658e05a4b2..5a5103ee88 100644
--- a/binutils/ld/configure.tgt
+++ b/binutils/ld/configure.tgt
@@ -70,6 +70,8 @@ aarch64_be-*-linux*)  targ_emul=aarch64linuxb
 aarch64-*-linux*)      targ_emul=aarch64linux
                        targ_extra_libpath="aarch64linuxb aarch64linux32 
aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
                        targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b 
aarch64elfb armelf armelfb $targ_extra_libpath" ;;
+aarch64-*-haiku*)      targ_emul=aarch64haiku
+                       targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b 
aarch64elfb armelf armelfb armelf_haiku $targ_extra_libpath" ;;
 alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
                        targ_emul=elf64alpha_fbsd
                        targ_extra_emuls="elf64alpha alpha"
diff --git a/binutils/ld/emulparams/aarch64haiku.sh 
b/binutils/ld/emulparams/aarch64haiku.sh
new file mode 100644
index 0000000000..87315ffe5f
--- /dev/null
+++ b/binutils/ld/emulparams/aarch64haiku.sh
@@ -0,0 +1,39 @@
+ARCH=aarch64
+MACHINE=
+NOP=0x1f2003d5
+
+SCRIPT_NAME=elf
+ELFSIZE=64
+OUTPUT_FORMAT="elf64-littleaarch64"
+BIG_OUTPUT_FORMAT="elf64-bigaarch64"
+LITTLE_OUTPUT_FORMAT="elf64-littleaarch64"
+NO_REL_RELOCS=yes
+
+TEMPLATE_NAME=elf32
+EXTRA_EM_FILE=aarch64elf
+
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
+SEPARATE_GOTPLT=24
+IREL_IN_PLT=
+
+TEXT_START_ADDR=0x400000
+
+DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
+
+# AArch64 does not support .s* sections.
+NO_SMALL_DATA=yes
+
+OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = 
.${CREATE_SHLIB+)};"
+OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = 
.${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
+OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
+
+OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
+ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP 
(*(.gnu.attributes)) }'
+# Ensure each PLT entry is aligned to a cache line.
+PLT=".plt          ${RELOCATING-0} : ALIGN(16) { 
*(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
+
+. ${srcdir}/emulparams/elf_haiku.sh

############################################################################

Revision:    btrev43153
Commit:      e4426fc38a49e3b9f8ef350663717a8caef4d6c8
URL:         https://git.haiku-os.org/buildtools/commit/?id=e4426fc38a49
Author:      Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
Date:        Fri Aug 30 17:33:02 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun Sep  1 03:06:22 2019 UTC

gcc: Add initial support for AArch64 Haiku

Signed-off-by: Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
Change-Id: I8bd362b61ded01ae1b15d0a999d0db947204aeb7
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/1797
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc
index 80309f6833..33f7bba963 100644
--- a/gcc/gcc/config.gcc
+++ b/gcc/gcc/config.gcc
@@ -993,6 +993,11 @@ aarch64*-*-freebsd*)
        tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-freebsd.h"
        tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-freebsd"
        ;;
+aarch64*-*-haiku*)
+       tm_file="${tm_file} dbxelf.h elfos.h haiku.h haiku-stdint.h"
+       tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-haiku.h"
+       tmake_file="${tmake_file} t-haiku aarch64/t-aarch64 
aarch64/t-aarch64-haiku"
+       ;;
 aarch64*-*-linux*)
        tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
        tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h"
diff --git a/gcc/gcc/config/aarch64/aarch64-haiku.h 
b/gcc/gcc/config/aarch64/aarch64-haiku.h
new file mode 100644
index 0000000000..1d499305d9
--- /dev/null
+++ b/gcc/gcc/config/aarch64/aarch64-haiku.h
@@ -0,0 +1,94 @@
+/* Machine description for AArch64 architecture.
+   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Contributed by ARM Ltd.
+   Updated for Haiku by Jaroslaw Pelczar <jarek@xxxxxxxxxxxx>
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_AARCH64_HAIKU_H
+#define GCC_AARCH64_HAIKU_H
+
+#define HAIKU_DYNAMIC_LINKER           "/system/runtime_loader"
+
+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
+
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define TARGET_LINKER_EMULATION  "aarch64haikub"
+#else
+#define TARGET_LINKER_EMULATION  "aarch64haiku"
+#endif
+
+#undef  SUBTARGET_EXTRA_LINK_SPEC
+#define SUBTARGET_EXTRA_LINK_SPEC " -m" TARGET_LINKER_EMULATION
+
+#undef  HAIKU_TARGET_LINK_SPEC
+#define HAIKU_TARGET_LINK_SPEC "                                 \
+    %{p:%nconsider using `-pg' instead of `-p' with gprof (1) } \
+    %{v:-V}                                                     \
+    %{assert*} %{R*} %{rpath*} %{defsym*}                       \
+    %{shared:-Bshareable %{h*} %{soname*}}                      \
+    %{symbolic:-Bsymbolic}                                      \
+    %{static:-Bstatic}                                          \
+    %{!static:                                                  \
+      %{rdynamic:-export-dynamic}                               \
+      %{!shared:-dynamic-linker " HAIKU_DYNAMIC_LINKER " }}     \
+    -X" SUBTARGET_EXTRA_LINK_SPEC "                             \
+    %{mbig-endian:-EB} %{mlittle-endian:-EL}"
+
+#if TARGET_FIX_ERR_A53_835769_DEFAULT
+#define CA53_ERR_835769_SPEC \
+  " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#else
+#define CA53_ERR_835769_SPEC \
+  " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#endif
+
+#if TARGET_FIX_ERR_A53_843419_DEFAULT
+#define CA53_ERR_843419_SPEC \
+  " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}"
+#else
+#define CA53_ERR_843419_SPEC \
+  " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}"
+#endif
+
+#define LINK_SPEC HAIKU_TARGET_LINK_SPEC \
+                  CA53_ERR_835769_SPEC \
+                  CA53_ERR_843419_SPEC
+
+#define TARGET_OS_CPP_BUILTINS()               \
+  do                                                                   \
+    {                                                                  \
+       builtin_define ("__HAIKU__");                                   \
+       builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
+       builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
+    builtin_define ("__STDC_ISO_10646__=201103L"); \
+       builtin_assert ("system=haiku");                                        
\
+    }                                                                  \
+  while (0)
+
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
+/* Uninitialized common symbols in non-PIE executables, even with
+   strong definitions in dependent shared libraries, will resolve
+   to COPY relocated symbol in the executable.  See PR65780.  */
+#undef TARGET_BINDS_LOCAL_P
+#define TARGET_BINDS_LOCAL_P default_binds_local_p_2
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+#endif  /* GCC_AARCH64_HAIKU_H */
diff --git a/gcc/gcc/config/aarch64/t-aarch64-haiku 
b/gcc/gcc/config/aarch64/t-aarch64-haiku
new file mode 100644
index 0000000000..99d3dea36d
--- /dev/null
+++ b/gcc/gcc/config/aarch64/t-aarch64-haiku
@@ -0,0 +1,21 @@
+# Machine description for AArch64 architecture.
+#  Copyright (C) 2016-2018 Free Software Foundation, Inc.
+#
+#  This file is part of GCC.
+#
+#  GCC is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 3, or (at your option)
+#  any later version.
+#
+#  GCC is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with GCC; see the file COPYING3.  If not see
+#  <http://www.gnu.org/licenses/>.
+
+LIB1ASMSRC   = aarch64/lib1funcs.asm
+LIB1ASMFUNCS = _aarch64_sync_cache_range
diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host
index fe2c056fa6..0c8d4245d6 100644
--- a/gcc/libgcc/config.host
+++ b/gcc/libgcc/config.host
@@ -354,6 +354,11 @@ aarch64*-*-fuchsia*)
        tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
        tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp"
        ;;
+aarch64*-*-haiku*)
+       tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+       tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp"
+       md_unwind_header=aarch64/haiku-unwind.h
+       ;;
 aarch64*-*-linux*)
        extra_parts="$extra_parts crtfastmath.o"
        md_unwind_header=aarch64/linux-unwind.h
diff --git a/gcc/libgcc/config/aarch64/haiku-unwind.h 
b/gcc/libgcc/config/aarch64/haiku-unwind.h
new file mode 100644
index 0000000000..3c8d33d6a4
--- /dev/null
+++ b/gcc/libgcc/config/aarch64/haiku-unwind.h
@@ -0,0 +1,51 @@
+/* DWARF2 EH unwinding support for FreeBSD/ARM64 (aarch64).
+   Copyright (C) 2017-2018 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@xxxxxxxxx>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* Identify a signal frame, and set the frame state data appropriately.
+   See unwind-dw2.c for the structs. */
+
+/* Always include AArch64 unwinder header file.  */
+#include "config/aarch64/aarch64-unwind.h"
+
+#include <sys/types.h>
+#include <signal.h>
+#include <unistd.h>
+#include <signal.h>
+
+#define REG_NAME(reg)   mc_gpregs.gp_## reg
+#define XREG(num)       mc_gpregs.gp_x[num]
+#define DARC            __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__
+
+#define MD_FALLBACK_FRAME_STATE_FOR aarch64_haiku_fallback_frame_state
+
+static _Unwind_Reason_Code
+aarch64_haiku_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  // For now just signal end of stack. Once the Haiku implementation
+  // for AArch64 is more mature we can consider writing something similar
+  // to Linux or FreeBSD support.
+  return _URC_END_OF_STACK;
+}


Other related posts:

  • » [haiku-commits] buildtools: btrev43153 - gcc/gcc/config/aarch64 gcc/libgcc/config/aarch64 binutils/ld/emulparams binutils/ld gcc - waddlesplash