Skip to content

Commit 0c21102

Browse files
committed
[ppc64le] Fixed pg_bitutils.c build error for Power architecture.
1 parent d3a70e9 commit 0c21102

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

WORKSPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ http_archive(
88
build_file = "//ml_metadata:postgresql.BUILD",
99
workspace_file_content = "//ml_metadata:postgresql.WORKSPACE",
1010
sha256 = "9868c1149a04bae1131533c5cbd1c46f9c077f834f6147abaef8791a7c91b1a1",
11+
patches = ["//ml_metadata/third_party:postgresql.patch",],
1112
strip_prefix = "postgresql-12.1",
1213
urls = [
1314
"https://ftp.postgresql.org/pub/source/v12.1/postgresql-12.1.tar.gz",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git src/port/pg_bitutils.c src/port/pg_bitutils.c
2+
index 7847e8a..17714af 100644
3+
--- src/port/pg_bitutils.c
4+
+++ src/port/pg_bitutils.c
5+
@@ -12,12 +12,14 @@
6+
*/
7+
#include "c.h"
8+
9+
+#if !defined(__ppc__) && !defined(__PPC__) && !defined(__ppc64__) && !defined(__PPC64__)
10+
#ifdef HAVE__GET_CPUID
11+
#include <cpuid.h>
12+
#endif
13+
#ifdef HAVE__CPUID
14+
#include <intrin.h>
15+
#endif
16+
+#endif
17+
18+
#include "port/pg_bitutils.h"
19+
20+
@@ -141,6 +143,7 @@ int (*pg_popcount64) (uint64 word) = pg_popcount64_slow;
21+
static bool
22+
pg_popcount_available(void)
23+
{
24+
+#if !defined(__ppc__) && !defined(__PPC__) && !defined(__ppc64__) && !defined(__PPC64__)
25+
unsigned int exx[4] = {0, 0, 0, 0};
26+
27+
#if defined(HAVE__GET_CPUID)
28+
@@ -152,6 +155,9 @@ pg_popcount_available(void)
29+
#endif
30+
31+
return (exx[2] & (1 << 23)) != 0; /* POPCNT */
32+
+#else
33+
+ return false;
34+
+#endif
35+
}
36+
37+
/*
38+

0 commit comments

Comments
 (0)