new file mode 100644
@@ -0,0 +1,57 @@
+From 49b8283544ae5c897f4cf186e174f98a9dc6e1c6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 11 Nov 2026 07:56:45 -0800
+Subject: [PATCH] ld.hugetlbfs: Use --image-base with LLD
+
+LLD does not implement the GNU ld -Ttext-segment option and errors out:
+
+ ld.lld: error: -Ttext-segment is not supported. Use --image-base if you intend to set the base address
+
+which breaks linking the --hugetlbfs-align testcases when LD is lld. Detect
+LLD and pass the equivalent --image-base instead. LLD reads the value with
+base auto-detection, so emit the address with a 0x prefix, which GNU ld also
+accepts.
+
+Upstream-Status: Submitted [https://github.com/libhugetlbfs/libhugetlbfs/pull/118]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ ld.hugetlbfs | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/ld.hugetlbfs b/ld.hugetlbfs
+index d4a6306..11db0cf 100755
+--- a/ld.hugetlbfs
++++ b/ld.hugetlbfs
+@@ -126,6 +126,12 @@ armelf*_linux_eabi|aarch64elf*|aarch64linux*)
+ SLICE_SIZE=$HPAGE_SIZE ;;
+ esac
+
++# LLD does not implement -Ttext-segment, --image-base is its equivalent
++TEXTSEG="-Ttext-segment="
++if ${LD} --version 2>/dev/null | grep -q "^LLD"; then
++ TEXTSEG="--image-base="
++fi
++
+ if [ "$HTLB_ALIGN" == "slice" ]; then
+ HTLBOPTS="-zcommon-page-size=$SLICE_SIZE -zmax-page-size=$SLICE_SIZE"
+ HTLBOPTS="$HTLBOPTS -lhugetlbfs"
+@@ -134,13 +140,13 @@ if [ "$HTLB_ALIGN" == "slice" ]; then
+ # otherwise it will be NULL.
+ case "$EMU" in
+ armelf*_linux_eabi|aarch64elf*|aarch64linux*)
+- printf -v TEXTADDR "%x" "$SLICE_SIZE"
+- HTLBOPTS="$HTLBOPTS -Ttext-segment=$TEXTADDR" ;;
+- elf_i386) HTLBOPTS="$HTLBOPTS -Ttext-segment=0x08000000" ;;
++ printf -v TEXTADDR "0x%x" "$SLICE_SIZE"
++ HTLBOPTS="$HTLBOPTS ${TEXTSEG}$TEXTADDR" ;;
++ elf_i386) HTLBOPTS="$HTLBOPTS ${TEXTSEG}0x08000000" ;;
+ elf64ppc|elf64lppc)
+ if [ "$MMU_TYPE" == "Hash" ] ; then
+- printf -v TEXTADDR "%x" "$SLICE_SIZE"
+- HTLBOPTS="$HTLBOPTS -Ttext-segment=$TEXTADDR"
++ printf -v TEXTADDR "0x%x" "$SLICE_SIZE"
++ HTLBOPTS="$HTLBOPTS ${TEXTSEG}$TEXTADDR"
+ fi ;;
+ esac
+ fi
@@ -26,6 +26,7 @@ SRC_URI = " \
file://0013-elflink.c-include-libgen.h-for-basename.patch \
file://0014-tests-Add-ldflags-to-linker-commandline-for-libheaps.patch \
file://0015-support-reproducible-builds.patch \
+ file://0016-ld.hugetlbfs-Use-image-base-with-LLD.patch \
"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
ld.hugetlbfs runs $LD as the real linker and adds the GNU ld only -Ttext-segment option for --hugetlbfs-align links on arm/aarch64, i386 and ppc64. Now that LD is ld.lld this fails with ld.lld: error: -Ttext-segment is not supported. Use --image-base if you intend to set the base address Teach ld.hugetlbfs to use --image-base when the linker is LLD. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com> --- ...ld.hugetlbfs-Use-image-base-with-LLD.patch | 57 +++++++++++++++++++ .../libhugetlbfs/libhugetlbfs_2.24.bb | 1 + 2 files changed, 58 insertions(+) create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0016-ld.hugetlbfs-Use-image-base-with-LLD.patch