[openwrt/openwrt] toolchain/gcc: fix build on MacOS arm64
LEDE Commits
lede-commits at lists.infradead.org
Thu Dec 2 05:45:38 PST 2021
aparcar pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/ab241e0937c9cea4ae606f204ce82749373611f0
commit ab241e0937c9cea4ae606f204ce82749373611f0
Author: Sergey V. Lobanov <sergey at lobanov.in>
AuthorDate: Mon Nov 29 19:09:10 2021 +0300
toolchain/gcc: fix build on MacOS arm64
Added patch for GCC to fix compilation issues on MacOS arm64
The original commit message from Przemysław Buczkowski:
GCC: Patch for Apple Silicon compatibility
This patch fixes a linker error occuring when compiling
the cross-compiler on macOS and ARM64 architecture.
Adapted from:
https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
Signed-off-by: Sergey V. Lobanov <sergey at lobanov.in>
---
.../11.2.0/970-macos_arm64-building-fix.patch | 49 ++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/toolchain/gcc/patches/11.2.0/970-macos_arm64-building-fix.patch b/toolchain/gcc/patches/11.2.0/970-macos_arm64-building-fix.patch
new file mode 100644
index 0000000000..6572b8e559
--- /dev/null
+++ b/toolchain/gcc/patches/11.2.0/970-macos_arm64-building-fix.patch
@@ -0,0 +1,49 @@
+commit 9c6e71079b46ad5433165feaa2001450f2017b56
+Author: Przemysław Buczkowski <prem at prem.moe>
+Date: Mon Aug 16 13:16:21 2021 +0100
+
+ GCC: Patch for Apple Silicon compatibility
+
+ This patch fixes a linker error occuring when compiling
+ the cross-compiler on macOS and ARM64 architecture.
+
+ Adapted from:
+ https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
+
+ Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
+ Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
+ Reviewed-by: John Scipione <jscipione at gmail.com>
+ Reviewed-by: Adrien Destugues <pulkomandy at gmail.com>
+
+diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
+index 976f9afae5..736b83ff0b 100644
+--- a/gcc/config/aarch64/aarch64.h
++++ b/gcc/config/aarch64/aarch64.h
+@@ -1000,7 +1000,7 @@ extern const char *aarch64_rewrite_mcpu (int argc, const char **argv);
+ #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
+ { "rewrite_mcpu", aarch64_rewrite_mcpu },
+
+-#if defined(__aarch64__)
++#if defined(__aarch64__) && ! defined(__APPLE__)
+ extern const char *host_detect_local_cpu (int argc, const char **argv);
+ #define HAVE_LOCAL_CPU_DETECT
+ # define EXTRA_SPEC_FUNCTIONS \
+diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
+index 8f700eec85..b737abc006 100644
+--- a/gcc/config/host-darwin.c
++++ b/gcc/config/host-darwin.c
+@@ -22,6 +22,8 @@
+ #include "coretypes.h"
+ #include "diagnostic-core.h"
+ #include "config/host-darwin.h"
++#include "hosthooks.h"
++#include "hosthooks-def.h"
+
+ /* Yes, this is really supposed to work. */
+ static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
+@@ -75,3 +77,5 @@ darwin_gt_pch_use_address (void *addr, size_t sz, int fd, size_t off)
+
+ return ret;
+ }
++
++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
More information about the lede-commits
mailing list