Skip to contentSkip to conversation

libhugetlbfs: Use linker wrapper during build

PATCH New Khem Raj 1 participant 1 message Oct 8, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 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'

---
v2: Keep the gold hack intact

 .../recipes-benchmark/libhugetlbfs/libhugetlbfs_2.24.bb  | 9 +++++++++
 1 file changed, 9 insertions(+)
meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_2.24.bb +9 -0
index 00b34ad4ab..7a2d7c7a85 100644
@@ -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
@@ -55,6 +57,13 @@ do_configure:prepend() {
     fi
 }
 
+do_configure:prepend() {
+    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() {
     oe_runmake PREFIX=${prefix} DESTDIR=${D}  \
         INST_TESTSDIR32=${libdir}/libhugetlbfs/tests \