how-lix-os-pkgs/mrustc/default/patches-available/0100-ppc64-support.patch

60 lines
2.1 KiB
Diff

diff --git a/src/trans/target.cpp b/src/trans/target.cpp
index f36bbfc1..6688aa72 100644
--- a/src/trans/target.cpp
+++ b/src/trans/target.cpp
@@ -44,6 +44,18 @@ const TargetArch ARCH_M68K = {
{ /*atomic(u8)=*/true, false, true, false, true },
TargetArch::Alignments(2, 2, 2, 2, 2, 2, 2)
};
+const TargetArch ARCH_POWERPC64 = {
+ "powerpc64",
+ 64, true,
+ { /*atomic(u8)=*/true, true, true, true, true },
+ TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8)
+};
+const TargetArch ARCH_POWERPC64LE = {
+ "powerpc64",
+ 64, false,
+ { /*atomic(u8)=*/true, true, true, true, true },
+ TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8)
+};
TargetSpec g_target;
@@ -404,6 +416,20 @@ namespace
ARCH_M68K
};
}
+ else if(target_name == "powerpc64-alpine-linux-musl")
+ {
+ return TargetSpec {
+ "unix", "linux", "musl", {CodegenMode::Gnu11, false, "powerpc64-alpine-linux-musl", BACKEND_C_OPTS_GNU},
+ ARCH_POWERPC64
+ };
+ }
+ else if(target_name == "powerpc64le-alpine-linux-musl")
+ {
+ return TargetSpec {
+ "unix", "linux", "musl", {CodegenMode::Gnu11, false, "powerpc64le-alpine-linux-musl", BACKEND_C_OPTS_GNU},
+ ARCH_POWERPC64LE
+ };
+ }
else if(target_name == "i586-pc-windows-gnu")
{
return TargetSpec {
diff --git a/tools/common/target_detect.h b/tools/common/target_detect.h
index dda4bc31..5753ae95 100644
--- a/tools/common/target_detect.h
+++ b/tools/common/target_detect.h
@@ -26,6 +26,10 @@
# define DEFAULT_TARGET_NAME "i586-linux-gnu"
# elif defined(__m68k__)
# define DEFAULT_TARGET_NAME "m68k-linux-gnu"
+# elif defined (__powerpc64__) && defined(__LITTLE_ENDIAN__)
+# define DEFAULT_TARGET_NAME "powerpc64le-alpine-linux-musl"
+# elif defined (__powerpc64__) && defined(__BIG_ENDIAN__)
+# define DEFAULT_TARGET_NAME "powerpc64-alpine-linux-musl"
# else
# warning "Unable to detect a suitable default target (linux-gnu)"
# endif