perl: Disable strict aliasing with clang

clang-21+ compiled perl ends up with segfults in
various places if this optimization is enabled

panic: del_backref, svp=0 at /usr/lib/perl5/5.40.2/warnings.pm line 622.
Compilation failed in require at /usr/lib/perl5/5.40.2/Getopt/Std.pm line 4.

The crash starts at frame #0 in Perl_sv_kill_backrefs() at sv.c:6420
called during magic cleanup (Perl_magic_killbackrefs)

(From OE-Core rev: d4af9e6a1c0090e4ee9b1199adf2144636997f03)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2025-08-06 21:14:00 -07:00
committed by Richard Purdie
parent d2edf7d352
commit 324b1bfa0d

View File

@@ -50,6 +50,10 @@ export ENC2XS_NO_COMMENTS = "1"
CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
# Perl built with clang runs into sefaults with clang-21+
# https://github.com/llvm/llvm-project/issues/152241
CFLAGS:append:toolchain-clang = " -fno-strict-aliasing"
do_configure:prepend() {
rm -rf ${B}
cp -rfp ${S} ${B}