Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building the ps3 toolchain on Apple M1 (arm64) #114

Open
bucanero opened this issue Sep 22, 2021 · 1 comment
Open

Building the ps3 toolchain on Apple M1 (arm64) #114

bucanero opened this issue Sep 22, 2021 · 1 comment

Comments

@bucanero
Copy link
Contributor

bucanero commented Sep 22, 2021

I just got a new laptop (with Apple's M1 chip) and I had to rebuild the toolchain from scratch.

Good news: the PS3 toolchain and PSL1GHT SDK can be rebuilt on arm64 arch.
But... patches and fixes must be done here & there to compile. 😅

For the toolchain:

I had to fix gcc-7.2.0 with this patch 0023-apple-silicon.diff:
https://github.com/richfelker/musl-cross-make/pull/129/files

diff -ru a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
--- a/gcc/config/host-darwin.c 2021-05-14 10:42:08.000000000 +0200
+++ b/gcc/config/host-darwin.c 2021-08-07 22:51:11.000000000 +0200
@@ -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 @@
   return ret;
 }
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff -ru a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
--- a/gcc/config/aarch64/aarch64.h  2018-02-01 22:09:06.000000000 +0100
+++ b/gcc/config/aarch64/aarch64.h  2021-08-10 00:50:52.000000000 +0200
@@ -930,7 +930,7 @@
 #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 EXTRA_SPEC_FUNCTIONS                  \
   { "local_cpu_detect", host_detect_local_cpu },        \

I also had to fix gdb-7.5.1 too, adding #include <sys/ioctl.h> in two files, as shown in #103

@bucanero
Copy link
Contributor Author

Related to this topic, I have submitted a couple of PRs to fix some library path issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant