libhugetlbfs: Use linker wrapper during build

ld.hugetlbfs is munging certain linker commandline options
and presenting a differently named options to its users, in
summary its expecting linker process to call ld.hugetlbfs
which calls the final linker with additional decorations.

This patch makes space for that by adding -B option to compiler
so it finds this the linker in S and then we creates symlinks
for linker name that clang/gcc are expecting.

Fixes

libhugetlbfs/2.24/recipe-sysroot-native/usr/bin/x86_64-yoe-linux/x86_64-yoe-linux-ld.bfd: unrecognized option '--hugetlbfs-link=B'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit dc84a9e699)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Khem Raj
2024-10-06 20:18:40 -07:00
parent bc81a983b7
commit 31d5c4ae9e
@@ -46,6 +46,8 @@ export HUGETLB_LDSCRIPT_PATH="${S}/ldscripts"
TARGET_CC_ARCH += "${LDFLAGS}"
LDFLAGS += "-B${S}"
inherit autotools-brokensep cpan-base
#The CUSTOM_LDSCRIPTS doesn't work with the gold linker
@@ -53,6 +55,11 @@ do_configure:prepend() {
if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
sed -i 's/CUSTOM_LDSCRIPTS = yes/CUSTOM_LDSCRIPTS = no/' Makefile.in
fi
ln -sf ld.hugetlbfs ${S}/ld
ln -sf ld.hugetlbfs ${S}/ld.bfd
ln -sf ld.hugetlbfs ${S}/ld.gold
ln -sf ld.hugetlbfs ${S}/ld.lld
}
do_install() {
@@ -61,7 +68,8 @@ do_install() {
INST_TESTSDIR64=${libdir}/libhugetlbfs/tests \
install-tests
sed -i -e 's|${RECIPE_SYSROOT_NATIVE}||g' \
sed -i \
-e 's|${RECIPE_SYSROOT_NATIVE}||g' \
-e 's|${RECIPE_SYSROOT}||g' \
`find ${D}${libdir}/libhugetlbfs/tests -name dummy.ldscript`
}