summaryrefslogtreecommitdiff
path: root/t/porting
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2022-11-23 09:04:07 +1100
committerTony Cook <tony@develop-help.com>2022-11-28 13:50:41 +1100
commit69b4fa321bd1c6357cd9687eef887d23ac009ab0 (patch)
treedb42863668f2a3c09be3c1dad3dc74cec1316ff6 /t/porting
parent99d24a03f4f65d155416e04274b943ae7245dc21 (diff)
downloadperl-69b4fa321bd1c6357cd9687eef887d23ac009ab0.tar.gz
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
Diffstat (limited to 't/porting')
-rw-r--r--t/porting/libperl.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/porting/libperl.t b/t/porting/libperl.t
index ff5f1811c6..f6361cdb01 100644
--- a/t/porting/libperl.t
+++ b/t/porting/libperl.t
@@ -9,6 +9,9 @@
# - freebsd
# and on other platforms, and if things seem odd, just give up (skip_all).
#
+# Symbol types for LTO builds don't seem to match their final section, so
+# skip on LTO builds too.
+#
# Debugging tip: nm output (this script's input) can be faked by
# giving one command line argument for this script: it should be
# either the filename to read, or "-" for STDIN. You can also append
@@ -47,6 +50,15 @@ if ($Config{cc} =~ /g\+\+/) {
skip_all "on g++";
}
+# ccname is gcc for both gcc and clang
+if ($Config{ccname} eq "gcc" && $Config{ccflags} =~ /-flto\b/) {
+ # If we compile with gcc nm marks PL_no_mem as "D" (normal data) rather than a R (read only)
+ # but the symbol still ends up in the .rodata section of the image on linking.
+ # If we compile with clang 14, nm marks PL_no_mem as "T" (text, aka code) rather than R
+ # but the symbol still ends up in the .rodata section on linking.
+ skip_all "LTO libperl.a flags don't match the final linker sections";
+}
+
my $libperl_a;
for my $f (qw(../libperl.a libperl.a)) {