Skip to content

Commit 9b620e0

Browse files
committed
Added GCC-11 and Power support
1 parent d3a70e9 commit 9b620e0

File tree

3 files changed

+146
-4
lines changed

3 files changed

+146
-4
lines changed

WORKSPACE

Lines changed: 5 additions & 4 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",
@@ -50,10 +51,10 @@ http_archive(
5051

5152
http_archive(
5253
name = "boringssl",
53-
sha256 = "1188e29000013ed6517168600fc35a010d58c5d321846d6a6dfee74e4c788b45",
54-
strip_prefix = "boringssl-7f634429a04abc48e2eb041c81c5235816c96514",
54+
sha256 = "579cb415458e9f3642da0a39a72f79fdfe6dc9c1713b3a823f1e276681b9703e",
55+
strip_prefix = "boringssl-648cbaf033401b7fe7acdce02f275b06a88aab5c",
5556
urls = [
56-
"https://github.com/google/boringssl/archive/7f634429a04abc48e2eb041c81c5235816c96514.tar.gz",
57+
"https://github.com/google/boringssl/archive/648cbaf033401b7fe7acdce02f275b06a88aab5c.tar.gz",
5758
],
5859
)
5960

@@ -252,7 +253,7 @@ http_archive(
252253
name = "com_google_zetasql",
253254
urls = ["https://github.com/google/zetasql/archive/%s.zip" % ZETASQL_COMMIT],
254255
strip_prefix = "zetasql-%s" % ZETASQL_COMMIT,
255-
#patches = ["//ml_metadata/third_party:zetasql.patch"],
256+
patches = ["//ml_metadata/third_party:zetasql.patch"],
256257
sha256 = '651a768cd51627f58aa6de7039aba9ddab22f4b0450521169800555269447840'
257258
)
258259

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+

ml_metadata/third_party/zetasql.patch

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
diff --git bazel/m4.patch bazel/m4.patch
2+
index 544cbaa..c536bdc 100644
3+
--- bazel/m4.patch
4+
+++ bazel/m4.patch
5+
@@ -131,3 +131,97 @@
6+
# else
7+
# define USE_SNPRINTF 0
8+
# endif
9+
+diff --git lib/c-stack.c lib/c-stack.c
10+
+index 5353c08..a608fbe 100644
11+
+--- lib/c-stack.c
12+
++++ lib/c-stack.c
13+
+@@ -50,16 +50,16 @@
14+
+ #if ! HAVE_STACK_T && ! defined stack_t
15+
+ typedef struct sigaltstack stack_t;
16+
+ #endif
17+
+-#ifndef SIGSTKSZ
18+
+-# define SIGSTKSZ 16384
19+
+-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
20+
+-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
21+
+- more than the Linux default of an 8k alternate stack when deciding
22+
+- if a fault was caused by stack overflow. */
23+
+-# undef SIGSTKSZ
24+
+-# define SIGSTKSZ 16384
25+
+-#endif
26+
+-
27+
++/* Storage for the alternate signal stack.
28+
++ * 64 KiB is not too large for Gnulib-using apps, and is large enough
29+
++ * for all known platforms. Smaller sizes may run into trouble.
30+
++ * For example, libsigsegv 2.6 through 2.8 have a bug where some
31+
++ * architectures use more than the Linux default of an 8 KiB alternate
32+
++ * stack when deciding if a fault was caused by stack overflow. */
33+
++static max_align_t alternate_signal_stack[(64 * 1024
34+
++ + sizeof (max_align_t) - 1)
35+
++ / sizeof (max_align_t)];
36+
++
37+
+ #include <stdlib.h>
38+
+ #include <string.h>
39+
+
40+
+@@ -128,18 +128,6 @@ die (int signo)
41+
+ #if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \
42+
+ && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV
43+
+
44+
+-/* Storage for the alternate signal stack. */
45+
+-static union
46+
+-{
47+
+- char buffer[SIGSTKSZ];
48+
+-
49+
+- /* These other members are for proper alignment. There's no
50+
+- standard way to guarantee stack alignment, but this seems enough
51+
+- in practice. */
52+
+- long double ld;
53+
+- long l;
54+
+- void *p;
55+
+-} alternate_signal_stack;
56+
+
57+
+ static void
58+
+ null_action (int signo __attribute__ ((unused)))
59+
+@@ -205,8 +193,8 @@ c_stack_action (void (*action) (int))
60+
+
61+
+ /* Always install the overflow handler. */
62+
+ if (stackoverflow_install_handler (overflow_handler,
63+
+- alternate_signal_stack.buffer,
64+
+- sizeof alternate_signal_stack.buffer))
65+
++ alternate_signal_stack,
66+
++ sizeof alternate_signal_stack))
67+
+ {
68+
+ errno = ENOTSUP;
69+
+ return -1;
70+
+@@ -279,14 +267,14 @@ c_stack_action (void (*action) (int))
71+
+ stack_t st;
72+
+ struct sigaction act;
73+
+ st.ss_flags = 0;
74+
++ st.ss_sp = alternate_signal_stack;
75+
++ st.ss_size = sizeof alternate_signal_stack;
76+
+ # if SIGALTSTACK_SS_REVERSED
77+
+ /* Irix mistakenly treats ss_sp as the upper bound, rather than
78+
+ lower bound, of the alternate stack. */
79+
+- st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *);
80+
+- st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *);
81+
+-# else
82+
+- st.ss_sp = alternate_signal_stack.buffer;
83+
+- st.ss_size = sizeof alternate_signal_stack.buffer;
84+
++ st.ss_size -= sizeof (void *);
85+
++ char *ss_sp = st.ss_sp;
86+
++ st.ss_sp = ss_sp + st.ss_size;
87+
+ # endif
88+
+ r = sigaltstack (&st, NULL);
89+
+ if (r != 0)
90+
+diff --git lib/c-stack.h lib/c-stack.h
91+
+index efd3b8f..df8a790 100644
92+
+--- lib/c-stack.h
93+
++++ lib/c-stack.h
94+
+@@ -34,7 +34,7 @@
95+
+ A null ACTION acts like an action that does nothing.
96+
+
97+
+ ACTION must be async-signal-safe. ACTION together with its callees
98+
+- must not require more than SIGSTKSZ bytes of stack space. Also,
99+
++ must not require more than 64 KiB of stack space. Also,
100+
+ ACTION should not call longjmp, because this implementation does
101+
+ not guarantee that it is safe to return to the original stack.
102+
+
103+

0 commit comments

Comments
 (0)