ltp: fix builds when host ld doesn't know about target ELF formats
PATCH 1/1 ltp: fix builds when host ld doesn't know about target ELF formats
The kvm tests use the host ld, which doesn't necessarily know about the target ELF format. It should be using the cross ld we built, so call $(LD) instead.
--- ...-kvm-use-LD-instead-of-hardcoding-ld.patch | 37 +++++++++++++++++++ meta/recipes-extended/ltp/ltp_20220527.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644 meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patch
meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patch new file +37 -0
@@ -0,0 +1,37 @@ +Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/948] +Signed-off-by: Ross Burton <[email protected]> + +From 7670233e43df2aed6d44b96c51b034f8e2d28a19 Mon Sep 17 00:00:00 2001 +From: Ross Burton <[email protected]> +Date: Tue, 12 Jul 2022 15:03:54 +0100 +Subject: [PATCH] kvm: use $(LD) instead of hardcoding ld + +In cross-compiled builds the host ld may not know the required ELF format, +so ensure we use $(LD) which will be the cross-capable ld binary. + +Signed-off-by: Ross Burton <[email protected]> +--- + testcases/kernel/kvm/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile +index 69a9946fe..4ddef9f95 100644 +--- a/testcases/kernel/kvm/Makefile ++++ b/testcases/kernel/kvm/Makefile +@@ -50,11 +50,11 @@ include $(top_srcdir)/include/mk/generic_leaf_target.mk + ifdef VERBOSE + $(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) + objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin +- ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin ++ $(LD) -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin + else + @$(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) + @objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin +- @ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin ++ @$(LD) -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin + @echo KVM_CC $(target_rel_dir)$@ + endif + @rm $*-payload.elf $*-payload.bin +-- +2.34.1 +
meta/recipes-extended/ltp/ltp_20220527.bb +1 -0
@@ -28,6 +28,7 @@ SRCREV = "6f88e0f6f1d6eb12c48c902f50f47ecbd3b0f18a" SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \ file://0001-Remove-OOM-tests-from-runtest-mm.patch \ file://disable_hanging_tests.patch \ + file://0001-kvm-use-LD-instead-of-hardcoding-ld.patch \ " S = "${WORKDIR}/git"
Signature · 1 line
2.34.1
the ltp patch is upstream worthy. Have you thought about sending it to the ltp community ?
Quoted 79 lines · Ross Burton
The kvm tests use the host ld, which doesn't necessarily know about the target ELF format. It should be using the cross ld we built, so call $(LD) instead.
Signed-off-by Ross Burton <[email protected]>--- ...-kvm-use-LD-instead-of-hardcoding-ld.patch | 37 +++++++++++++++++++ meta/recipes-extended/ltp/ltp_20220527.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644 meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patchmeta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patch new file +37
-0@@ -0,0 +1,37 @@ +Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/948] +Signed-off-by: Ross Burton <[email protected]> + +From 7670233e43df2aed6d44b96c51b034f8e2d28a19 Mon Sep 17 00:00:00 2001 +From: Ross Burton <[email protected]> +Date: Tue, 12 Jul 2022 15:03:54 +0100 +Subject: [PATCH] kvm: use $(LD) instead of hardcoding ld + +In cross-compiled builds the host ld may not know the required ELF format, +so ensure we use $(LD) which will be the cross-capable ld binary. + +Signed-off-by: Ross Burton <[email protected]> +--- + testcases/kernel/kvm/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile +index 69a9946fe..4ddef9f95 100644 +--- a/testcases/kernel/kvm/Makefile ++++ b/testcases/kernel/kvm/Makefile +@@ -50,11 +50,11 @@ include $(top_srcdir)/include/mk/generic_leaf_target.mk + ifdef VERBOSE + $(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) + objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin +- ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin ++ $(LD) -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin + else + @$(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) + @objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin +- @ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin ++ @$(LD) -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin + @echo KVM_CC $(target_rel_dir)$@ + endif + @rm $*-payload.elf $*-payload.bin +-- +2.34.1 +meta/recipes-extended/ltp/ltp_20220527.bb +1
-1@@ -28,6 +28,7 @@ SRCREV = "6f88e0f6f1d6eb12c48c902f50f47ecbd3b0f18a" SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \ file://0001-Remove-OOM-tests-from-runtest-mm.patch \ file://disable_hanging_tests.patch \ + file://0001-kvm-use-LD-instead-of-hardcoding-ld.patch \ " S = "${WORKDIR}/git" --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#167929): https://lists.openembedded.org/g/openembedded-core/message/167929
Mute This Topic: https://lists.openembedded.org/mt/92334178/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 3 lines · Khem Raj via lists.openembedded.org
the ltp patch is upstream worthy. Have you thought about sending it to the ltp community ?
See the patch header:
Quoted 1 line
Quoted 1 line
+Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/948]
That should now be Backport, as it’s been merged.
Ross
FYI: This might be causing build issues with ld-is-gold:
| i686-webos-linux-ld: error: kvm_pagefault01-payload.bin:1:1: invalid character
| ltp/20220527-r0/git/testcases/kernel/kvm/Makefile:55: recipe for target 'kvm_pagefault01-payload.o' failed
| make[3]: *** [kvm_pagefault01-payload.o] Error 1
The previous patch to use bfd:
https://git.openembedded.org/openembedded-core/commit/?id=674fd0c423f3a8911d73b4319ab23bd9b3f1bbac
was doing it only through -fuse-ld=bfd in LDFLAGS which doesn't seem to be used here.
Will check if it was really caused by this change after my builder gets online again (now in memtest86 with sad results).
Cheers,
Quoted 97 lines · Ross Burton
The kvm tests use the host ld, which doesn't necessarily know about the target ELF format. It should be using the cross ld we built, so call $(LD) instead.
Signed-off-by Ross Burton <[email protected]>--- ...-kvm-use-LD-instead-of-hardcoding-ld.patch | 37 +++++++++++++++++++ meta/recipes-extended/ltp/ltp_20220527.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644
meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patchdiff --git
a/meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patchb/meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patchnew file mode 100644
index 00000000000..23634d0c860
---/dev/null
+++b/meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patch(quoted diff) +1
-0@@ -0,0 +1,37 @@ +Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/948]
meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patch new file +20
-0+Signed-off-by: Ross Burton <[email protected]> + +From 7670233e43df2aed6d44b96c51b034f8e2d28a19 Mon Sep 17 00:00:00 2001 +From: Ross Burton <[email protected]> +Date: Tue, 12 Jul 2022 15:03:54 +0100 +Subject: [PATCH] kvm: use $(LD) instead of hardcoding ld + +In cross-compiled builds the host ld may not know the required ELF format, +so ensure we use $(LD) which will be the cross-capable ld binary. + +Signed-off-by: Ross Burton <[email protected]> +--- + testcases/kernel/kvm/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile +index 69a9946fe..4ddef9f95 100644 +--- a/testcases/kernel/kvm/Makefile ++++ b/testcases/kernel/kvm/Makefile +@@ -50,11 +50,11 @@ include $(top_srcdir)/include/mk/generic_leaf_target.mk
+ ifdef VERBOSE
+ $(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o
$*-payload.elf $^ $(GUEST_LDLIBS)
+ objcopy -O binary -j .init.boot -j .text -j .data -j .init -j
.preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin
+- ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT)(quoted diff) +3
-2-o $@ $*-payload.bin ++ $(LD) -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin + else + @$(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o$*-payload.elf $^ $(GUEST_LDLIBS)
+ @objcopy -O binary -j .init.boot -j .text -j .data -j .init -j
.preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin
+- @ld -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT)meta/recipes-extended/ltp/ltp/0001-kvm-use-LD-instead-of-hardcoding-ld.patch new file +7
-2-o $@ $*-payload.bin ++ @$(LD) -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin + @echo KVM_CC $(target_rel_dir)$@ + endif + @rm $*-payload.elf $*-payload.bin +-- +2.34.1 +meta/recipes-extended/ltp/ltp_20220527.bb +1
-0@@ -28,6 +28,7 @@ SRCREV = "6f88e0f6f1d6eb12c48c902f50f47ecbd3b0f18a" SRC_URI = "git:// github.com/linux-test-project/ltp.git;branch=master;protocol=https \ file://0001-Remove-OOM-tests-from-runtest-mm.patch \ file://disable_hanging_tests.patch \ + file://0001-kvm-use-LD-instead-of-hardcoding-ld.patch \ "S = "${WORKDIR}/git"
--
2.34.1-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#167929):
https://lists.openembedded.org/g/openembedded-core/message/167929
Mute This Topic: https://lists.openembedded.org/mt/92334178/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-