Message ID | 20210917152621.54651-1-kateinoigakukun@gmail.com |
---|---|
State | New |
Headers | show |
Series | darwin: support aarch64-darwin host | expand |
Hello Yuta thanks for your patch and interest. > On 17 Sep 2021, at 16:26, Yuta Saito via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > Currently, building gcc for aarch64-darwin host fails due to missing > host_hooks definition. > > This patch adds host_hooks definition for aarch64-darwin. > aarch64-darwin is not supported as a target yet, but this allows using > gcc cross-compiler on aarch64-darwin. 1. The development prototype for aarch64-darwin is here: https://github.com/iains/gcc-darwin-arm64 we need to phase the work into master with the approval of the Arm maintainers - so I would recommend that if you have fixes or improvements in the short-term, to make pull requests against the development branch. 2. The patch you have presented is identical in the host-only content to the existing development one: https://github.com/iains/gcc-darwin-arm64/commit/2190f7bda7bc0e6d0b74c7bd41c97510a685b06b So, that aspect has already been handled in the development. > I confirmed linking gcc-cross succeed on aarch64 darwin. Patches need more testing than that - specifically, that they do not regress other targets (unlikely, in this case, but it is good form to test at least that aarch64-linux-gnu is unaffected). ==== There are two other small changes I’d like to check before enabling host support 1/ https://github.com/iains/gcc-darwin-arm64/commit/98c8f79929db1bf29ac52f748137b08c21976483 might be needed for cross tools too. 2/ We need to ensure that PCH is defaulted to “off” and that there is a proper warning if the user tries to configure it “on” see: https://github.com/iains/gcc-darwin-arm64/issues/2 (which we do not plan to fix in the short term). ==== There is clearly interest in building cross-compilers on aarch64-darwin, so I will try to phase the host support sooner rather than later, thanks again for the patch, Iain
Hello Iain, Thank you for taking a look at my patch. > > Hello Yuta > > thanks for your patch and interest. > > > On 17 Sep 2021, at 16:26, Yuta Saito via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > > Currently, building gcc for aarch64-darwin host fails due to missing > > host_hooks definition. > > > > This patch adds host_hooks definition for aarch64-darwin. > > aarch64-darwin is not supported as a target yet, but this allows using > > gcc cross-compiler on aarch64-darwin. > > 1. The development prototype for aarch64-darwin is here: > https://github.com/iains/gcc-darwin-arm64 > > we need to phase the work into master with the approval of the Arm > maintainers - so I would recommend that if you have fixes or improvements > in the short-term, to make pull requests against the development branch. > > 2. > The patch you have presented is identical in the host-only content to > the existing development one: > > https://github.com/iains/gcc-darwin-arm64/commit/2190f7bda7bc0e6d0b74c7bd41c97510a685b06b > > So, that aspect has already been handled in the development. > Oh, I didn't know that development repository. > > I confirmed linking gcc-cross succeed on aarch64 darwin. > > Patches need more testing than that - specifically, that they do not > regress other targets (unlikely, in this case, but it is good form to > test at least that aarch64-linux-gnu is unaffected). > > ==== > > There are two other small changes I’d like to check before enabling host support > 1/ > https://github.com/iains/gcc-darwin-arm64/commit/98c8f79929db1bf29ac52f748137b08c21976483 > might be needed for cross tools too. > > 2/ > We need to ensure that PCH is defaulted to “off” and that there is a proper warning if > the user tries to configure it “on” see: > https://github.com/iains/gcc-darwin-arm64/issues/2 > (which we do not plan to fix in the short term). > Thank you for your advice. I'll apply these patches. > ==== > > There is clearly interest in building cross-compilers on aarch64-darwin, so I will try > to phase the host support sooner rather than later, > > thanks again for the patch, > Iain > I hope it will reach the upstream in the near future. Thanks again for working on the darwin-arm64 support. Yuta
diff --git a/gcc/config.host b/gcc/config.host index 0a02c33cc80..f419ee7c94c 100644 --- a/gcc/config.host +++ b/gcc/config.host @@ -263,6 +263,10 @@ case ${host} in out_host_hook_obj="${out_host_hook_obj} host-ppc64-darwin.o" host_xmake_file="${host_xmake_file} rs6000/x-darwin64" ;; + aarch64-*-darwin*) + out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o" + host_xmake_file="${host_xmake_file} aarch64/x-darwin" + ;; rs6000-ibm-aix* | powerpc-ibm-aix*) host_xmake_file="${host_xmake_file} rs6000/x-aix" ;; diff --git a/gcc/config/aarch64/host-aarch64-darwin.c b/gcc/config/aarch64/host-aarch64-darwin.c new file mode 100644 index 00000000000..388a8ebcc49 --- /dev/null +++ b/gcc/config/aarch64/host-aarch64-darwin.c @@ -0,0 +1,32 @@ +/* aarch64-darwin host-specific hook definitions. + Copyright (C) 2006-2021 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 aarch64 hosts; this file exists just + to include 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)
Hi, Currently, building gcc for aarch64-darwin host fails due to missing host_hooks definition. This patch adds host_hooks definition for aarch64-darwin. aarch64-darwin is not supported as a target yet, but this allows using gcc cross-compiler on aarch64-darwin. I confirmed linking gcc-cross succeed on aarch64 darwin. gcc/ChangeLog: * config.host: Add aarch64-darwin host support. * config/aarch64/host-aarch64-darwin.c: New file. * config/aarch64/x-darwin: Ditto. Signed-off-by: Yuta Saito <kateinoigakukun@gmail.com> --- gcc/config.host | 4 +++ gcc/config/aarch64/host-aarch64-darwin.c | 32 ++++++++++++++++++++++++ gcc/config/aarch64/x-darwin | 3 +++ 3 files changed, 39 insertions(+) create mode 100644 gcc/config/aarch64/host-aarch64-darwin.c create mode 100644 gcc/config/aarch64/x-darwin