Skip to content

Commit

Permalink
GCC: Patch for Apple Silicon compatibility
Browse files Browse the repository at this point in the history
This patch fixes a linker error occuring when compiling
the cross-compiler on macOS and ARM64 architecture.

Adapted from:
richfelker/musl-cross-make#116 (comment)

Change-Id: Ia3ee98a163bbb62689f42e2da83a5ef36beb0913
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4329
Reviewed-by: John Scipione <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
  • Loading branch information
przemub authored and pulkomandy committed Aug 23, 2021
1 parent 4ab0fe4 commit 9c6e710
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcc/gcc/config/aarch64/aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions gcc/gcc/config/host-darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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;

0 comments on commit 9c6e710

Please sign in to comment.