Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69b4fa3

Browse files
committed
skip checking categorization of libperl symbols for LTO builds
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes #20518
1 parent 99d24a0 commit 69b4fa3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/porting/libperl.t

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# - freebsd
1010
# and on other platforms, and if things seem odd, just give up (skip_all).
1111
#
12+
# Symbol types for LTO builds don't seem to match their final section, so
13+
# skip on LTO builds too.
14+
#
1215
# Debugging tip: nm output (this script's input) can be faked by
1316
# giving one command line argument for this script: it should be
1417
# either the filename to read, or "-" for STDIN. You can also append
@@ -47,6 +50,15 @@ if ($Config{cc} =~ /g\+\+/) {
4750
skip_all "on g++";
4851
}
4952

53+
# ccname is gcc for both gcc and clang
54+
if ($Config{ccname} eq "gcc" && $Config{ccflags} =~ /-flto\b/) {
55+
# If we compile with gcc nm marks PL_no_mem as "D" (normal data) rather than a R (read only)
56+
# but the symbol still ends up in the .rodata section of the image on linking.
57+
# If we compile with clang 14, nm marks PL_no_mem as "T" (text, aka code) rather than R
58+
# but the symbol still ends up in the .rodata section on linking.
59+
skip_all "LTO libperl.a flags don't match the final linker sections";
60+
}
61+
5062
my $libperl_a;
5163

5264
for my $f (qw(../libperl.a libperl.a)) {

0 commit comments

Comments
 (0)