Subject: | Don't overwrite OPTIMIZE in hints file. |
Hello,
hints/irix_6.pl forcefully overwrites the OPTIMIZE MakeMaker variable. This is a bad thing, since it loses some important compiler flags (debugging symbols, PERL_POISON), makes debugging difficult (as -O1 is always set), and can cause XS handshake errors with the most recent versions of blead.
This patch changes this to only lower the optimization level, akin to what Storable already does.
Vincent
Subject: | 0001-Preserve-OPTIMIZE-in-hints.patch |
From 677c181071205ee3eb9a3861af85da46671871ab Mon Sep 17 00:00:00 2001
From: Vincent Pit <perl@profvince.com>
Date: Tue, 17 Mar 2015 15:03:24 -0300
Subject: [PATCH] Preserve OPTIMIZE in hints
The irix_6 hints file forcefully overwrite OPTIMIZE in order to work around
a compiler mishap with high level optimizations. However, this loses
whatever extra flags are listed in OPTIMIZE, such as compiler warnings
flags or PERL_POISON, and makes the module difficult to run under a
debugger since a minimal level of optimization is always enforced. This may
also cause loading errors with the new XS handshake facility.
Instead, we chose to just follow Storable's strategy of lowering the
optimization level with a substitution, while keeping all the other flags
untouched. If other compiler flags are deemed problematic (such as
-mcpu/-march on gcc), they ought to be addressed separately.
---
hints/irix_6.pl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hints/irix_6.pl b/hints/irix_6.pl
index e38ae14..1b02bea 100644
--- a/hints/irix_6.pl
+++ b/hints/irix_6.pl
@@ -1,6 +1,9 @@
# The Mongoose v7.1 compiler freezes up somewhere in the optimization of
# MD5Transform() in MD5.c with optimization -O3. This is a workaround:
+use Config;
if ($Config{cc} =~ /64|n32/ && `$Config{cc} -version 2>&1` =~ /\s7\.1/) {
- $self->{OPTIMIZE} = "-O1";
+ my $optimize = $Config{optimize};
+ $optimize =~ s/(^| )-O[2-9]\b/$1-O1/g
+ and $self->{OPTIMIZE} = $optimize;
}
--
1.9.5 (Apple Git-50.3)