Making a tracking ticket here for now. Basically my progress so far:
$ build/muon-bootstrap -C build samu
[1/137] linking static subprojects/tinyjson/libtiny-json.a
[2/137] linking tools/embedder
samu: job failed with status 1: gcc-10 -o tools/embedder tools/embedder.p/embedder.c.o -Wl,--as-needed -Wl,--no-undefined
ld: 0706-012 The -- flag is not recognized.
ld: 0706-012 The -a flag is not recognized.
ld: 0706-012 The -- flag is not recognized.
ld: 0706-027 The -n flag is ignored.
ld: 0706-012 The -- flag is not recognized.
ld: 0706-027 The -n flag is ignored.
collect2: error: ld returned 255 exit status
samu: subcommand failed
(Note that OBJECT_MODE=64 is set so that ld assumes 64-bit, which is what GCC is generating by default here. It should probably be passing flags to tools explicitly for setting bitness, since AIX has fat binaries and thus a multi-bitness toolchain.)
I don't know how much you want to merge since it doesn't yet work, but (this includes the vendored Samurai fixes; I've sent issues to upstream there):
diff --git a/include/machines.h b/include/machines.h
index 305f98e9..6595d764 100644
--- a/include/machines.h
+++ b/include/machines.h
@@ -28,6 +28,8 @@ enum machine_system {
machine_system_cygwin,
machine_system_msys2,
machine_system_darwin,
+ machine_system_aix,
+ machine_system_os400,
};
enum machine_kind {
diff --git a/src/external/samurai/build.c b/src/external/samurai/build.c
index e7044da3..2d5eeecc 100644
--- a/src/external/samurai/build.c
+++ b/src/external/samurai/build.c
@@ -291,7 +291,7 @@ samu_jobstart(struct samu_ctx *ctx, struct samu_job *j, struct samu_edge *e)
if (build_machine.is_windows) {
cmd_started = run_cmd_unsplit(&j->cmd_ctx, j->cmd->s, 0, 0);
} else {
- char *argv[] = { "/bin/sh", "-c", j->cmd->s, NULL };
+ char *argv[] = { "/QOpenSys/bin/sh", "-c", j->cmd->s, NULL };
cmd_started = run_cmd_argv(&j->cmd_ctx, argv, 0, 0);
}
diff --git a/src/external/samurai/tree.c b/src/external/samurai/tree.c
index d8295653..0d9ca36a 100644
--- a/src/external/samurai/tree.c
+++ b/src/external/samurai/tree.c
@@ -18,6 +18,11 @@
#include "external/samurai/ctx.h"
+#ifdef _AIX
+/* AIX defines hz... */
+#undef hz
+#endif
+
#define MAXH (sizeof(void *) * 8 * 3 / 2)
static inline int
diff --git a/src/machines.c b/src/machines.c
index 12b3ea01..c19f8f45 100644
--- a/src/machines.c
+++ b/src/machines.c
@@ -88,6 +88,8 @@ machine_system_to_s(enum machine_system sys)
case machine_system_cygwin: return "cygwin";
case machine_system_msys2: return "msys2";
case machine_system_darwin: return "darwin";
+ case machine_system_aix: return "aix";
+ case machine_system_os400: return "os400";
}
UNREACHABLE_RETURN;
@@ -142,6 +144,9 @@ machine_system(const struct str *sysname)
{ "netbsd", machine_system_netbsd },
{ "openbsd", machine_system_openbsd },
{ "sunos", machine_system_sunos }, // illumos and Solaris
+ { "aix", machine_system_aix },
+ // XXX: This is compatible with AIX, but different enough
+ { "os400", machine_system_os400 }, // IBM i PASE (AIX compatible)
// TODO: These probably need more than just a simple mapping
{ "android", machine_system_android }, // By convention only, subject to change
diff --git a/src/platform/posix/uname.c b/src/platform/posix/uname.c
index bf65e802..8ccafacd 100644
--- a/src/platform/posix/uname.c
+++ b/src/platform/posix/uname.c
@@ -64,7 +64,15 @@ uname_sysname(void)
const char *
uname_machine(void)
{
+#ifdef _AIX
+ /*
+ * AIX puts a machine identification in uts.machine; since AIX only
+ * runs on PowerPC, let's just assume ppc(64)
+ */
+ return sizeof(void*) == 8 ? "ppc64" : "ppc";
+#else
uname_init();
return uname_info.machine;
+#endif
}
Making a tracking ticket here for now. Basically my progress so far:
(Note that
OBJECT_MODE=64is set so that ld assumes 64-bit, which is what GCC is generating by default here. It should probably be passing flags to tools explicitly for setting bitness, since AIX has fat binaries and thus a multi-bitness toolchain.)I don't know how much you want to merge since it doesn't yet work, but (this includes the vendored Samurai fixes; I've sent issues to upstream there):