summaryrefslogtreecommitdiff
path: root/ext/PerlIO-via
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2015-03-17 14:06:16 -0300
committerVincent Pit <perl@profvince.com>2015-03-17 20:29:38 -0300
commit4a33c86d2230d0bd3a803326e59d4d22a4ec286e (patch)
tree70adf01b3577dc106e40e1905b25b12eed126f33 /ext/PerlIO-via
parent15af3bc082ed025689f99225649aca215a9ad566 (diff)
downloadperl-4a33c86d2230d0bd3a803326e59d4d22a4ec286e.tar.gz
Preserve OPTIMIZE in hints
Some extensions hints files (B, Digest-MD5, PerlIO-via) forcefully overwrite OPTIMIZE in order to work around compiler mishaps with high level optimizations. However, this loses whatever extra flags are listed in OPTIMIZE, such as compiler warnings flags or PERL_POISON, and makes them difficult to run under a debugger since a minimal level of optimization (usually -O1) is always enforced. This has became visible recently with 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. Only B and PerlIO-via hints files are fixed by this change. The case of Digest-MD5 will be addressed on the CPAN. This fixes [RT #124038].
Diffstat (limited to 'ext/PerlIO-via')
-rw-r--r--ext/PerlIO-via/hints/aix.pl6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/PerlIO-via/hints/aix.pl b/ext/PerlIO-via/hints/aix.pl
index 960a8fdfe0..2b23ab3be7 100644
--- a/ext/PerlIO-via/hints/aix.pl
+++ b/ext/PerlIO-via/hints/aix.pl
@@ -1,2 +1,6 @@
# compilation may hang at -O3 level
-$self->{OPTIMIZE} = '-O';
+use Config;
+
+my $optimize = $Config{optimize};
+$optimize =~ s/(^| )-O[2-9]\b/$1-O/g
+ and $self->{OPTIMIZE} = $optimize;