970-macos_arm64-building-fix.patch 1.5 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. @@ -1236,7 +1236,7 @@ extern const char *aarch64_rewrite_mcpu
  16. #define MCPU_TO_MARCH_SPEC_FUNCTIONS \
  17. { "rewrite_mcpu", aarch64_rewrite_mcpu },
  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.c
  24. +++ b/gcc/config/host-darwin.c
  25. @@ -22,6 +22,8 @@
  26. #include "coretypes.h"
  27. #include "diagnostic-core.h"
  28. #include "config/host-darwin.h"
  29. +#include "hosthooks.h"
  30. +#include "hosthooks-def.h"
  31. /* Yes, this is really supposed to work. */
  32. /* This allows for a pagesize of 16384, which we have on Darwin20, but should
  33. @@ -79,3 +81,5 @@ darwin_gt_pch_use_address (void *addr, s
  34. return ret;
  35. }
  36. +
  37. +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;