]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
perl: Disable builtin memcpy & string inlines with gcc/x86-64-v3
authorKhem Raj <raj.khem@gmail.com>
Sun, 17 Aug 2025 05:53:31 +0000 (22:53 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 17 Aug 2025 20:36:46 +0000 (21:36 +0100)
PERL built with GCC 15 and -march=x86-64-v3 fails several
op/pack.t cases due to aggressive lowering of __builtin_memcpy
and inlined/fortified string ops. In pp_pack, some in-place copies
can overlap, treating memcpy as non-overlapping yields corrupted
bytes (zeros or wrong prefixes).

The issue does not reproduce with -march=core2.

When using x86-64-v3 memcpy gets emitted very aggressively
(vectorized / reordered) and assumes no overlap.

The flags force calls through libc (overlap-safe behavior),
restoring deterministic pack/unpack and fixing the test failures.

Inline functions could be faster in execution but correctness is
more important

Fixes [YOCTO #15950]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/perl/perl_5.40.2.bb

index 1df1467d42457a733d31aa73f5f7414b6af5ca8e..a78d2ed0be98cba7a6c616f231dd6535c9ed7ce9 100644 (file)
@@ -54,6 +54,9 @@ CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 # https://github.com/llvm/llvm-project/issues/152241
 CFLAGS:append:toolchain-clang = " -fno-strict-aliasing"
 
+# Needed with -march=x86-64-v3
+CFLAGS:append:toolchain-gcc:class-target:x86-64 = " -fno-builtin-memcpy -D__NO_STRING_INLINES -U_FORTIFY_SOURCE"
+
 do_configure:prepend() {
     rm -rf ${B}
     cp -rfp ${S} ${B}