blob: 89730449f5547a0d313b08567fcfd31cec3398c7 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001commit 9c6e71079b46ad5433165feaa2001450f2017b56
2Author: Przemysław Buczkowski <prem@prem.moe>
3Date: Mon Aug 16 13:16:21 2021 +0100
4
5 GCC: Patch for Apple Silicon compatibility
6
7 This patch fixes a linker error occuring when compiling
8 the cross-compiler on macOS and ARM64 architecture.
9
10 Adapted from:
11 https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
12
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>
17
18--- a/gcc/config/aarch64/aarch64.h
19+++ b/gcc/config/aarch64/aarch64.h
20@@ -1293,7 +1293,7 @@ extern const char *aarch64_rewrite_mcpu
21 #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
22 { "rewrite_mcpu", aarch64_rewrite_mcpu },
23
24-#if defined(__aarch64__)
25+#if defined(__aarch64__) && ! defined(__APPLE__)
26 extern const char *host_detect_local_cpu (int argc, const char **argv);
27 #define HAVE_LOCAL_CPU_DETECT
28 # define EXTRA_SPEC_FUNCTIONS \
29--- a/gcc/config/host-darwin.cc
30+++ b/gcc/config/host-darwin.cc
31@@ -23,6 +23,8 @@
32 #include "options.h"
33 #include "diagnostic-core.h"
34 #include "config/host-darwin.h"
35+#include "hosthooks.h"
36+#include "hosthooks-def.h"
37 #include <errno.h>
38
39 /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the
40@@ -181,3 +183,5 @@ darwin_gt_pch_use_address (void *&addr,
41
42 return 1;
43 }
44+
45+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;