7831
|
1 |
A 64-bit build results in a segfault in the parsers module (on both SPARC
|
|
2 |
and x86). Dialing down the optimization to -xO1 eliminates the crash.
|
|
3 |
|
|
4 |
In order to only lower the optimization for the one object that needs it
|
|
5 |
and only in a 64-bit build, we do some monkeypatching of the distutils
|
|
6 |
compiler class, and replace its _compile() method with one that does that
|
|
7 |
check and replaces the original optimization level with the lower one.
|
|
8 |
|
|
9 |
This patch can be removed when we move to Studio 12.5.
|
|
10 |
|
|
11 |
--- a/setup.py 2017-02-01 08:18:58.000000000 -0800
|
|
12 |
+++ b/setup.py 2017-02-03 18:13:20.479471297 -0800
|
|
13 |
@@ -302,7 +302,18 @@
|
|
14 |
|
|
15 |
return build_ext.build_extensions(self)
|
|
16 |
|
|
17 |
+ def my_compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
|
|
18 |
+ if src == "mercurial/parsers.c" and "-m64" in self.compiler.compiler_so:
|
|
19 |
+ for i, arg in enumerate(self.compiler.compiler_so):
|
|
20 |
+ if arg.startswith("-xO"):
|
|
21 |
+ break
|
|
22 |
+ self.compiler.compiler_so[i] = "-xO1"
|
|
23 |
+ self.compiler.old_compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
|
|
24 |
+
|
|
25 |
def build_extension(self, ext):
|
|
26 |
+ if not hasattr(self.compiler, "old_compile"):
|
|
27 |
+ self.compiler.old_compile = self.compiler._compile
|
|
28 |
+ self.compiler._compile = self.my_compile
|
|
29 |
try:
|
|
30 |
build_ext.build_extension(self, ext)
|
|
31 |
except CCompilerError:
|