gcc: Add some patches to get gcc 10.2 building on ARM based Mac

Pull in a change from upstream GCC and one from the gcc-darwin-arm64
repo that gets an initial cross compiler building on ARM based Mac.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-12-04 10:52:42 -06:00
parent f1eeb2b0f3
commit e7b3b20d0b
2 changed files with 132 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From 22a26745add0b02a96d1b65c953529f217a52bad Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat, 8 Aug 2020 12:15:09 +0100
Subject: [PATCH 1/2] Darwin: Adjust the PCH area to allow for 16384byte page
size.
Newer versions of Darwin report pagesize 20 which means that we
need to adjust the aligment of the PCH area.
gcc/ChangeLog:
* config/host-darwin.c: Align pch_address_space to 16384.
---
gcc/config/host-darwin.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
index 0face6c450f..c862935dcf3 100644
--- a/gcc/config/host-darwin.c
+++ b/gcc/config/host-darwin.c
@@ -24,7 +24,10 @@
#include "config/host-darwin.h"
/* Yes, this is really supposed to work. */
-static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
+/* This allows for a pagesize of 16384, which we have on Darwin20, but should
+ continue to work OK for pagesize 4096 which we have on earlier versions.
+ The size is 1 (binary) Gb. */
+static char pch_address_space[65536*16384] __attribute__((aligned (16384)));
/* Return the address of the PCH address space, if the PCH will fit in it. */
--
2.28.0

View File

@ -0,0 +1,97 @@
From ffecb0ce72f51ec134dc33636eedcebe53e4ec9e Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Tue, 18 Aug 2020 22:29:51 +0100
Subject: [PATCH 2/2] Darwin, Arm64: Initial support for the self-host driver.
At present, this just includes the generic Darwin stuff.
NOTE:
This patch is pulled from: https://github.com/iains/gcc-darwin-arm64/
See commit 89dc5a9d5ed3e6b2ba6a4725bd51841ee758b6cd
Its been backported to gcc-10.2
---
gcc/config.host | 7 +++++-
gcc/config/aarch64/host-aarch64-darwin.c | 32 ++++++++++++++++++++++++
gcc/config/aarch64/x-darwin | 3 +++
3 files changed, 41 insertions(+), 1 deletion(-)
create mode 100644 gcc/config/aarch64/host-aarch64-darwin.c
create mode 100644 gcc/config/aarch64/x-darwin
diff --git a/gcc/config.host b/gcc/config.host
index 84f0433e2ad..8489145e1b1 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -99,7 +99,8 @@ case ${host} in
esac
case ${host} in
- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*)
+ aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\
+ aarch64-*-darwin* | arm64*-*-darwin*)
case ${target} in
aarch64*-*-*)
host_extra_gcc_objs="driver-aarch64.o"
@@ -251,6 +252,10 @@ case ${host} in
host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o"
host_lto_plugin_soname=liblto_plugin-0.dll
;;
+ aarch64-*-darwin* | arm64-*-darwin*)
+ out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o"
+ host_xmake_file="${host_xmake_file} aarch64/x-darwin"
+ ;;
i[34567]86-*-darwin* | x86_64-*-darwin*)
out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o"
host_xmake_file="${host_xmake_file} i386/x-darwin"
diff --git a/gcc/config/aarch64/host-aarch64-darwin.c b/gcc/config/aarch64/host-aarch64-darwin.c
new file mode 100644
index 00000000000..1a2cd4c9dab
--- /dev/null
+++ b/gcc/config/aarch64/host-aarch64-darwin.c
@@ -0,0 +1,32 @@
+/* Arm64-darwin host-specific hook definitions.
+ Copyright (C) 2020 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/>. */
+
+#define IN_TARGET_CODE 1
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
+#include "config/host-darwin.h"
+
+/* Darwin doesn't do anything special for arm64/aarch64 hosts; this file
+ exists just to include the generic config/host-darwin.h. */
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff --git a/gcc/config/aarch64/x-darwin b/gcc/config/aarch64/x-darwin
new file mode 100644
index 00000000000..6d788d5e89c
--- /dev/null
+++ b/gcc/config/aarch64/x-darwin
@@ -0,0 +1,3 @@
+host-aarch64-darwin.o : $(srcdir)/config/aarch64/host-aarch64-darwin.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
--
2.28.0