970-macos_arm64-building-fix.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. commit 9c6e71079b46ad5433165feaa2001450f2017b56
  2. Author: Przemysław Buczkowski <prem@prem.moe>
  3. Date: Mon Aug 16 13:16:21 2021 +0100
  4. GCC: Patch for Apple Silicon compatibility
  5. This patch fixes a linker error occuring when compiling
  6. the cross-compiler on macOS and ARM64 architecture.
  7. Adapted from:
  8. https://github.com/richfelker/musl-cross-make/issues/116#issuecomment-823612404
  9. Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
  10. Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
  11. Reviewed-by: John Scipione <jscipione@gmail.com>
  12. Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
  13. --- a/gcc/config/aarch64/aarch64.h
  14. +++ b/gcc/config/aarch64/aarch64.h
  15. @@ -1185,7 +1185,7 @@ extern enum aarch64_code_model aarch64_c
  16. /* Extra specs when building a native AArch64-hosted compiler.
  17. Option rewriting rules based on host system. */
  18. -#if defined(__aarch64__)
  19. +#if defined(__aarch64__) && ! defined(__APPLE__)
  20. extern const char *host_detect_local_cpu (int argc, const char **argv);
  21. #define HAVE_LOCAL_CPU_DETECT
  22. # define EXTRA_SPEC_FUNCTIONS \
  23. --- a/gcc/config/host-darwin.cc
  24. +++ b/gcc/config/host-darwin.cc
  25. @@ -23,6 +23,8 @@
  26. #include "options.h"
  27. #include "diagnostic-core.h"
  28. #include "config/host-darwin.h"
  29. +#include "hosthooks.h"
  30. +#include "hosthooks-def.h"
  31. #include <errno.h>
  32. /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the
  33. @@ -181,3 +183,5 @@ darwin_gt_pch_use_address (void *&addr,
  34. return 1;
  35. }
  36. +
  37. +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;