Skip to content

Commit 18073b7

Browse files
committed
5.36: disable BUILTIN_EXPECT and compile with -Os
Updates #85
1 parent fcdfa6a commit 18073b7

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

share/64bit-5.36.0.1.pp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,18 @@
107107
'<dist_sharedir>/perl-5.36/perlexe.rc.tt' => 'win32/perlexe.rc',
108108
'<dist_sharedir>/perl-5.36/perl_pr19663.diff' => '*',
109109
'<dist_sharedir>/perl-5.36/rt142390.patch' => '*',
110-
'<dist_sharedir>/perl-5.36/perl_pr20008.diff' => '*',
110+
'<dist_sharedir>/perl-5.36/perl_pr20008.diff' => '*',
111+
'<dist_sharedir>/perl-5.36/perl_pr20136.patch' => '*',
111112
'config_H.gc' => {
112113
I_DBM => 'define',
113114
I_GDBM => 'define',
114115
I_NDBM => 'define',
115-
HAS_BUILTIN_EXPECT => 'define',
116+
#HAS_BUILTIN_EXPECT => 'define',
116117
HAS_BUILTIN_CHOOSE_EXPR => 'define',
117118
},
118119
'config.gc' => { # see Step.pm for list of default updates
119120
d_builtin_choose_expr => 'define',
120-
d_builtin_expect => 'define',
121+
#d_builtin_expect => 'define',
121122
d_mkstemp => 'define',
122123
d_ndbm => 'define',
123124
i_db => 'define',

share/perl-5.36/perl_pr20136.patch

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From cc51139c88a245c5942733f231181798cd3b310f Mon Sep 17 00:00:00 2001
2+
From: Kenneth Olwing <[email protected]>
3+
Date: Thu, 25 Aug 2022 18:48:26 +0200
4+
Subject: [PATCH] Change optimization level for Win32 builds
5+
6+
This fixes #20136.
7+
8+
Building on Windows 11 with the Strawberry 5.32.1 (gcc 8.3.0) toolchain,
9+
multiple errors in the tests are seen. Worse, building on Windows 10
10+
no test errors crop up, but the resulting perl will still crash and die
11+
when run the tests manually on Windows 11.
12+
13+
Changing the optimization level to -Os as found in #20024, the build now
14+
and tests now succeed.
15+
---
16+
win32/GNUmakefile | 9 +++++++--
17+
1 file changed, 7 insertions(+), 2 deletions(-)
18+
19+
diff --git a/win32/GNUmakefile b/win32/GNUmakefile
20+
index 7b91d35ab004..81ded707b946 100644
21+
--- a/win32/GNUmakefile
22+
+++ b/win32/GNUmakefile
23+
@@ -608,11 +608,16 @@ LIBFILES += -lquadmath
24+
endif
25+
26+
ifeq ($(CFG),Debug)
27+
-OPTIMIZE = -g -O2
28+
+# According to https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/Optimize-Options.html
29+
+# -Og should provide some optimizations while still giving convenient debugging
30+
+OPTIMIZE = -g -Og
31+
LINK_DBG = -g
32+
DEFINES += -DDEBUGGING
33+
else
34+
-OPTIMIZE = -O2
35+
+# In https://github.com/Perl/perl5/issues/20081 it is found that the previous
36+
+# optimization level -O2 causes generated code that fails in mysterious ways
37+
+# when run on Win11 (*even* if it was built and successfully tested on Win10!).
38+
+OPTIMIZE = -Os
39+
LINK_DBG = -s
40+
endif
41+

0 commit comments

Comments
 (0)