1 commit 9c6e71079b46ad5433165feaa2001450f2017b56
2 Author: Przemysław Buczkowski <prem@prem.moe>
3 Date: Mon Aug 16 13:16:21 2021 +0100
5 GCC: Patch for Apple Silicon compatibility
7 This patch fixes a linker error occuring when compiling
8 the cross-compiler on macOS and ARM64 architecture.
11 https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
13 Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
14 Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
15 Reviewed-by: John Scipione <jscipione@gmail.com>
16 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
18 diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
19 index 976f9afae5..736b83ff0b 100644
20 --- a/gcc/config/aarch64/aarch64.h
21 +++ b/gcc/config/aarch64/aarch64.h
22 @@ -1000,7 +1000,7 @@ extern const char *aarch64_rewrite_mcpu (int argc, const char **argv);
23 #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
24 { "rewrite_mcpu", aarch64_rewrite_mcpu },
26 -#if defined(__aarch64__)
27 +#if defined(__aarch64__) && ! defined(__APPLE__)
28 extern const char *host_detect_local_cpu (int argc, const char **argv);
29 #define HAVE_LOCAL_CPU_DETECT
30 # define EXTRA_SPEC_FUNCTIONS \
31 diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
32 index 8f700eec85..b737abc006 100644
33 --- a/gcc/config/host-darwin.c
34 +++ b/gcc/config/host-darwin.c
36 #include "coretypes.h"
37 #include "diagnostic-core.h"
38 #include "config/host-darwin.h"
39 +#include "hosthooks.h"
40 +#include "hosthooks-def.h"
42 /* Yes, this is really supposed to work. */
43 static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
44 @@ -75,3 +77,5 @@ darwin_gt_pch_use_address (void *addr, size_t sz, int fd, size_t off)
49 +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;