* [LTP] [PATCH] Add KVM_LD Makefile variable for building KVM payload binaries
@ 2022-07-25 15:37 Martin Doucha
2022-07-26 9:30 ` Richard Palethorpe
0 siblings, 1 reply; 2+ messages in thread
From: Martin Doucha @ 2022-07-25 15:37 UTC (permalink / raw)
To: ltp
KVM linker needs to be configurable for cross-compiling but some
linkers don't support the linker script for wrapping arbitrary files
into linkable resource files. Allow KVM linker to be changed
independently of $LD via $KVM_LD.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
This should solve the issues with
https://github.com/linux-test-project/ltp/pull/948
doc/build-system-guide.txt | 5 +++++
testcases/kernel/kvm/Makefile | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/doc/build-system-guide.txt b/doc/build-system-guide.txt
index 166f7fb92..b8d267b4b 100644
--- a/doc/build-system-guide.txt
+++ b/doc/build-system-guide.txt
@@ -145,6 +145,11 @@ $(CPPFLAGS) : Preprocessor flags, e.g. -I arguments.
$(DEBUG_CFLAGS) : Debug flags to pass to $(CC), -g, etc.
+$(KVM_LD) : Special linker for wrapping KVM payload binaries
+ into linkable object files. Defaults to $(LD).
+ Change this variable if the KVM Makefile fails
+ to build files named *-payload.o.
+
$(LD) : The system linker (typically $(CC), but not
necessarily).
diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
index 22a840da6..6986844be 100644
--- a/testcases/kernel/kvm/Makefile
+++ b/testcases/kernel/kvm/Makefile
@@ -11,6 +11,7 @@ GUEST_CPPFLAGS = $(CPPFLAGS) -DCOMPILE_PAYLOAD
GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse
GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fno-stack-protector
GUEST_LDLIBS =
+KVM_LD ?= $(LD)
FILTER_OUT_MAKE_TARGETS := lib_guest lib_host lib_x86
@@ -53,11 +54,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) -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin
+ $(KVM_LD) -z noexecstack -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) -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin
+ @$(KVM_LD) -z noexecstack -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.36.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] Add KVM_LD Makefile variable for building KVM payload binaries
2022-07-25 15:37 [LTP] [PATCH] Add KVM_LD Makefile variable for building KVM payload binaries Martin Doucha
@ 2022-07-26 9:30 ` Richard Palethorpe
0 siblings, 0 replies; 2+ messages in thread
From: Richard Palethorpe @ 2022-07-26 9:30 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hello,
Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
Martin Doucha <mdoucha@suse.cz> writes:
> KVM linker needs to be configurable for cross-compiling but some
> linkers don't support the linker script for wrapping arbitrary files
> into linkable resource files. Allow KVM linker to be changed
> independently of $LD via $KVM_LD.
>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>
> This should solve the issues with
> https://github.com/linux-test-project/ltp/pull/948
>
> doc/build-system-guide.txt | 5 +++++
> testcases/kernel/kvm/Makefile | 5 +++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/doc/build-system-guide.txt b/doc/build-system-guide.txt
> index 166f7fb92..b8d267b4b 100644
> --- a/doc/build-system-guide.txt
> +++ b/doc/build-system-guide.txt
> @@ -145,6 +145,11 @@ $(CPPFLAGS) : Preprocessor flags, e.g. -I arguments.
>
> $(DEBUG_CFLAGS) : Debug flags to pass to $(CC), -g, etc.
>
> +$(KVM_LD) : Special linker for wrapping KVM payload binaries
> + into linkable object files. Defaults to $(LD).
> + Change this variable if the KVM Makefile fails
> + to build files named *-payload.o.
> +
> $(LD) : The system linker (typically $(CC), but not
> necessarily).
>
> diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
> index 22a840da6..6986844be 100644
> --- a/testcases/kernel/kvm/Makefile
> +++ b/testcases/kernel/kvm/Makefile
> @@ -11,6 +11,7 @@ GUEST_CPPFLAGS = $(CPPFLAGS) -DCOMPILE_PAYLOAD
> GUEST_CFLAGS = -ffreestanding -O2 -Wall -fno-asynchronous-unwind-tables -mno-mmx -mno-sse
> GUEST_LDFLAGS = -nostdlib -Wl,--build-id=none -fno-stack-protector
> GUEST_LDLIBS =
> +KVM_LD ?= $(LD)
>
> FILTER_OUT_MAKE_TARGETS := lib_guest lib_host lib_x86
>
> @@ -53,11 +54,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) -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin
> + $(KVM_LD) -z noexecstack -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) -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin
> + @$(KVM_LD) -z noexecstack -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.36.1
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-26 9:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 15:37 [LTP] [PATCH] Add KVM_LD Makefile variable for building KVM payload binaries Martin Doucha
2022-07-26 9:30 ` Richard Palethorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.