Skip to contentSkip to conversation

perf: Fix to obey LD failure on qemux86-64

PATCH New Sujith H 1 participant 1 message Sep 8, 2016

lore
Share & tools
lore

Sujith H

author
#0 lore raw

PATCH 1/1 perf: Fix to obey LD failure on qemux86-64

From: Christopher Larson <[email protected]>

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/fs.o)
to format elf32-i386 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/libapi-in.o) is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld will fail.

---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-kernel/perf/perf.bb +9 -0
index 88e3a0a..85fe0ea 100644
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \
 "
 
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}
 
 do_compile() {
 	# Linux kernel build system is expected to do the right thing
Signature · 1 line
1.9.1