Skip to content

Commit 271ef22

Browse files
committed
patches for building gcc on Apple Silicon
By @jannau in #116.
1 parent 3398364 commit 271ef22

File tree

6 files changed

+168
-0
lines changed

6 files changed

+168
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
2+
--- a/gcc/config/host-darwin.c 2021-05-14 10:42:08.000000000 +0200
3+
+++ b/gcc/config/host-darwin.c 2021-08-07 22:51:11.000000000 +0200
4+
@@ -22,6 +22,8 @@
5+
#include "coretypes.h"
6+
#include "diagnostic-core.h"
7+
#include "config/host-darwin.h"
8+
+#include "hosthooks.h"
9+
+#include "hosthooks-def.h"
10+
11+
/* Yes, this is really supposed to work. */
12+
static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
13+
@@ -75,3 +77,5 @@
14+
15+
return ret;
16+
}
17+
+
18+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
2+
--- a/gcc/config/host-darwin.c 2021-05-14 10:42:08.000000000 +0200
3+
+++ b/gcc/config/host-darwin.c 2021-08-07 22:51:11.000000000 +0200
4+
@@ -22,6 +22,8 @@
5+
#include "coretypes.h"
6+
#include "diagnostic-core.h"
7+
#include "config/host-darwin.h"
8+
+#include "hosthooks.h"
9+
+#include "hosthooks-def.h"
10+
11+
/* Yes, this is really supposed to work. */
12+
static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
13+
@@ -75,3 +77,5 @@
14+
15+
return ret;
16+
}
17+
+
18+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
19+
diff -ru a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
20+
--- a/gcc/config/aarch64/aarch64.h 2018-02-01 22:33:05.000000000 +0100
21+
+++ b/gcc/config/aarch64/aarch64.h 2021-08-10 00:40:48.000000000 +0200
22+
@@ -907,7 +907,7 @@
23+
#define MCPU_TO_MARCH_SPEC_FUNCTIONS \
24+
{ "rewrite_mcpu", aarch64_rewrite_mcpu },
25+
26+
-#if defined(__aarch64__)
27+
+#if defined(__aarch64__) && ! defined(__APPLE__)
28+
extern const char *host_detect_local_cpu (int argc, const char **argv);
29+
# define EXTRA_SPEC_FUNCTIONS \
30+
{ "local_cpu_detect", host_detect_local_cpu }, \
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
2+
--- a/gcc/config/host-darwin.c 2021-05-14 10:42:08.000000000 +0200
3+
+++ b/gcc/config/host-darwin.c 2021-08-07 22:51:11.000000000 +0200
4+
@@ -22,6 +22,8 @@
5+
#include "coretypes.h"
6+
#include "diagnostic-core.h"
7+
#include "config/host-darwin.h"
8+
+#include "hosthooks.h"
9+
+#include "hosthooks-def.h"
10+
11+
/* Yes, this is really supposed to work. */
12+
static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
13+
@@ -75,3 +77,5 @@
14+
15+
return ret;
16+
}
17+
+
18+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
19+
diff -ru a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
20+
--- a/gcc/config/aarch64/aarch64.h 2018-02-01 22:09:06.000000000 +0100
21+
+++ b/gcc/config/aarch64/aarch64.h 2021-08-10 00:50:52.000000000 +0200
22+
@@ -930,7 +930,7 @@
23+
#define MCPU_TO_MARCH_SPEC_FUNCTIONS \
24+
{ "rewrite_mcpu", aarch64_rewrite_mcpu },
25+
26+
-#if defined(__aarch64__)
27+
+#if defined(__aarch64__) && ! defined(__APPLE__)
28+
extern const char *host_detect_local_cpu (int argc, const char **argv);
29+
# define EXTRA_SPEC_FUNCTIONS \
30+
{ "local_cpu_detect", host_detect_local_cpu }, \
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
2+
--- a/gcc/config/host-darwin.c 2021-05-14 10:42:08.000000000 +0200
3+
+++ b/gcc/config/host-darwin.c 2021-08-07 22:51:11.000000000 +0200
4+
@@ -22,6 +22,8 @@
5+
#include "coretypes.h"
6+
#include "diagnostic-core.h"
7+
#include "config/host-darwin.h"
8+
+#include "hosthooks.h"
9+
+#include "hosthooks-def.h"
10+
11+
/* Yes, this is really supposed to work. */
12+
static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
13+
@@ -75,3 +77,5 @@
14+
15+
return ret;
16+
}
17+
+
18+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
19+
diff -ru a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
20+
--- a/gcc/config/aarch64/aarch64.h 2021-05-14 10:42:08.000000000 +0200
21+
+++ b/gcc/config/aarch64/aarch64.h 2021-08-10 00:54:13.000000000 +0200
22+
@@ -1013,7 +1013,7 @@
23+
#define MCPU_TO_MARCH_SPEC_FUNCTIONS \
24+
{ "rewrite_mcpu", aarch64_rewrite_mcpu },
25+
26+
-#if defined(__aarch64__)
27+
+#if defined(__aarch64__) && ! defined(__APPLE__)
28+
extern const char *host_detect_local_cpu (int argc, const char **argv);
29+
#define HAVE_LOCAL_CPU_DETECT
30+
# define EXTRA_SPEC_FUNCTIONS \
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
2+
--- a/gcc/config/host-darwin.c 2019-01-01 13:31:55.000000000 +0100
3+
+++ b/gcc/config/host-darwin.c 2021-08-07 19:21:05.000000000 +0200
4+
@@ -22,6 +22,8 @@
5+
#include "coretypes.h"
6+
#include "diagnostic-core.h"
7+
#include "config/host-darwin.h"
8+
+#include "hosthooks.h"
9+
+#include "hosthooks-def.h"
10+
11+
/* Yes, this is really supposed to work. */
12+
static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
13+
@@ -75,3 +77,5 @@
14+
15+
return ret;
16+
}
17+
+
18+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
19+
diff -ru a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
20+
--- a/gcc/config/aarch64/aarch64.h 2019-07-05 17:06:11.000000000 +0200
21+
+++ b/gcc/config/aarch64/aarch64.h 2021-08-10 00:56:32.000000000 +0200
22+
@@ -1049,7 +1049,7 @@
23+
#define MCPU_TO_MARCH_SPEC_FUNCTIONS \
24+
{ "rewrite_mcpu", aarch64_rewrite_mcpu },
25+
26+
-#if defined(__aarch64__)
27+
+#if defined(__aarch64__) && ! defined(__APPLE__)
28+
extern const char *host_detect_local_cpu (int argc, const char **argv);
29+
#define HAVE_LOCAL_CPU_DETECT
30+
# define EXTRA_SPEC_FUNCTIONS \
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
2+
--- a/gcc/config/host-darwin.c 2021-04-08 13:56:28.000000000 +0200
3+
+++ b/gcc/config/host-darwin.c 2021-04-20 23:05:04.000000000 +0200
4+
@@ -22,6 +22,8 @@
5+
#include "coretypes.h"
6+
#include "diagnostic-core.h"
7+
#include "config/host-darwin.h"
8+
+#include "hosthooks.h"
9+
+#include "hosthooks-def.h"
10+
11+
/* Yes, this is really supposed to work. */
12+
/* This allows for a pagesize of 16384, which we have on Darwin20, but should
13+
@@ -78,3 +80,5 @@
14+
15+
return ret;
16+
}
17+
+
18+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
19+
diff -ru a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
20+
--- a/gcc/config/aarch64/aarch64.h 2021-06-01 09:53:04.000000000 +0200
21+
+++ b/gcc/config/aarch64/aarch64.h 2021-08-10 00:58:25.000000000 +0200
22+
@@ -1083,7 +1083,7 @@
23+
#define MCPU_TO_MARCH_SPEC_FUNCTIONS \
24+
{ "rewrite_mcpu", aarch64_rewrite_mcpu },
25+
26+
-#if defined(__aarch64__)
27+
+#if defined(__aarch64__) && ! defined(__APPLE__)
28+
extern const char *host_detect_local_cpu (int argc, const char **argv);
29+
#define HAVE_LOCAL_CPU_DETECT
30+
# define EXTRA_SPEC_FUNCTIONS \

0 commit comments

Comments
 (0)