redis: avoid LTO for clang builds

In Redis 8.0.x, the build system adds -flto by itself when clang is
used with the default optimization setting. In OE clang builds, the
final link still goes through the cross binutils linker path. That path
does not stage LLVMgold.so, so redis-benchmark link fails with:

  x86_64-oe-linux-ld: ../lib/LLVMgold.so: error loading plugin

The failure is not seen with gcc because Redis does not add clang LTO in
that path. Also, changing OPTIMIZATION from the recipe is not a good fit
because it replaces Redis defaults and drops -fno-omit-frame-pointer.

Use Redis documented OPT variable only for clang builds. This avoids
the clang LTO path and keeps the frame-pointer flag. The gcc/default
build is left unchanged.

This local workaround can be removed later if LLVMgold/binutils-plugin
support is available in the toolchain path used by clang LTO builds.

Signed-off-by: Deepak Rathore <deeratho@cisco.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
Deepak Rathore
2026-08-24 12:58:55 +05:30
committed by Anuj Mittal
parent fb2bca0962
commit e4ed510b63
@@ -40,6 +40,10 @@ PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
PACKAGECONFIG[systemd] = "USE_SYSTEMD=yes,USE_SYSTEMD=no,systemd"
EXTRA_OEMAKE += "${PACKAGECONFIG_CONFARGS}"
# Redis adds -flto automatically to OPTIMIZATION when clang is used.
# Pass OPT instead, which is the documented way to provide explicit flags
# without Redis adding its own optimization defaults.
EXTRA_OEMAKE:append:toolchain-clang = " OPT='-fno-omit-frame-pointer'"
TARGET_LDFLAGS:append = " ${DEBUG_PREFIX_MAP}"