-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
patch-darwin-ppc.diff
79 lines (72 loc) · 2.15 KB
/
patch-darwin-ppc.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--- folly/Portability.h.orig 2022-07-30 03:08:35.000000000 +0545
+++ folly/Portability.h 2022-08-10 23:12:09.000000000 +0545
@@ -103,12 +103,18 @@
#define FOLLY_AARCH64 0
#endif
-#if defined(__powerpc64__)
+#if defined(__powerpc64__) || defined(__ppc64__)
#define FOLLY_PPC64 1
#else
#define FOLLY_PPC64 0
#endif
+#if defined(__ppc__)
+#define FOLLY_PPC 1
+#else
+#define FOLLY_PPC 0
+#endif
+
#if defined(__s390x__)
#define FOLLY_S390X 1
#else
@@ -120,6 +126,7 @@
constexpr bool kIsArchAmd64 = FOLLY_X64 == 1;
constexpr bool kIsArchAArch64 = FOLLY_AARCH64 == 1;
constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1;
+constexpr bool kIsArchPPC = FOLLY_PPC == 1;
constexpr bool kIsArchS390X = FOLLY_S390X == 1;
} // namespace folly
@@ -318,6 +325,9 @@
#else
constexpr auto kIsLittleEndian = true;
#endif
+#elif defined(__APPLE__) && defined(__POWERPC__)
+// Darwin ppc/ppc64
+constexpr auto kIsLittleEndian = false;
#else
constexpr auto kIsLittleEndian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__;
#endif
# https://github.com/mr-c/misc/wiki/pause-techniques-on-many-architectures
--- folly/portability/Asm.h.orig 2022-07-30 03:08:35.000000000 +0545
+++ folly/portability/Asm.h 2022-08-10 23:07:57.000000000 +0545
@@ -41,8 +41,10 @@
asm volatile("pause");
#elif FOLLY_AARCH64 || (defined(__arm__) && !(__ARM_ARCH < 7))
asm volatile("yield");
-#elif FOLLY_PPC64
+#elif FOLLY_PPC64 && !(defined(__APPLE__))
asm volatile("or 27,27,27");
+#elif (FOLLY_PPC || FOLLY_PPC64) && defined(__APPLE__)
+ __asm__ volatile ("or r27,r27,r27" ::: "memory");
#endif
}
} // namespace folly
# https://github.com/facebook/folly/issues/1834
--- folly/detail/base64_detail/Base64Api.cpp.orig 2022-08-14 12:11:09.000000000 +0700
+++ folly/detail/base64_detail/Base64Api.cpp 2022-08-14 12:19:29.000000000 +0700
@@ -31,10 +31,16 @@
base64URLDecodeSWAR};
}
#endif
+#if defined(__POWERPC__) // PowerPC BE
+ return {
+ base64EncodeScalar,
+ base64URLEncode};
+#else // Everything but PowerPC BE
return {
base64EncodeScalar,
base64URLEncodeScalar,
base64DecodeSWAR,
base64URLDecodeSWAR};
+#endif
}
} // namespace folly::detail::base64_detail