kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] s390x: Fix out-of-tree builds
@ 2021-07-16 10:52 Thomas Huth
  2021-07-16 11:56 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2021-07-16 10:52 UTC (permalink / raw)
  To: kvm, Janosch Frank; +Cc: Paolo Bonzini, Steffen Eiden

The support for "snippets" (nested guest binaries) that has been added
recently to the s390x folder broke the out-of-tree compilation. We
have to make sure that the snippet folder is created in the build
directory, too, and that linker script is taken from the source folder.

While we're at it, switch the gitlab-CI cross compiler job to use
out-of-tree builds, too, so that this does not happen so easily again.
We're still testing in-tree s390x builds with the native "s390x-kvm"
job on the s390x host, so we now test both, in-tree and out-of-tree
builds.

Fixes: 2f6fdb4ac446 ("s390x: snippets: Add snippet compilation")
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .gitlab-ci.yml | 4 +++-
 configure      | 4 ++++
 s390x/Makefile | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4aebb97..943b20f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -57,7 +57,9 @@ build-ppc64le:
 build-s390x:
  script:
  - dnf install -y qemu-system-s390x gcc-s390x-linux-gnu
- - ./configure --arch=s390x --cross-prefix=s390x-linux-gnu-
+ - mkdir build
+ - cd build
+ - ../configure --arch=s390x --cross-prefix=s390x-linux-gnu-
  - make -j2
  - ACCEL=tcg ./run_tests.sh
      selftest-setup intercept emulator sieve skey diag10 diag308 vector diag288
diff --git a/configure b/configure
index 1d4871e..1d4d855 100755
--- a/configure
+++ b/configure
@@ -296,6 +296,10 @@ if test ! -e Makefile; then
     ln -sf "$srcdir/$testdir/unittests.cfg" $testdir/
     ln -sf "$srcdir/run_tests.sh"
 
+    if [ -d "$srcdir/$testdir/snippets" ]; then
+        mkdir -p "$testdir/snippets/c"
+    fi
+
     echo "linking scripts..."
     ln -sf "$srcdir/scripts"
 fi
diff --git a/s390x/Makefile b/s390x/Makefile
index 07af26d..6565561 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -90,7 +90,7 @@ $(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(FLATLIBS)
 	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@
 
 $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_asmlib) $(FLATLIBS)
-	$(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib) $(FLATLIBS)
+	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib) $(FLATLIBS)
 	$(OBJCOPY) -O binary $@ $@
 	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [kvm-unit-tests PATCH] s390x: Fix out-of-tree builds
  2021-07-16 10:52 [kvm-unit-tests PATCH] s390x: Fix out-of-tree builds Thomas Huth
@ 2021-07-16 11:56 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-07-16 11:56 UTC (permalink / raw)
  To: Thomas Huth, kvm, Janosch Frank; +Cc: Steffen Eiden

On 16/07/21 12:52, Thomas Huth wrote:
> The support for "snippets" (nested guest binaries) that has been added
> recently to the s390x folder broke the out-of-tree compilation. We
> have to make sure that the snippet folder is created in the build
> directory, too, and that linker script is taken from the source folder.
> 
> While we're at it, switch the gitlab-CI cross compiler job to use
> out-of-tree builds, too, so that this does not happen so easily again.
> We're still testing in-tree s390x builds with the native "s390x-kvm"
> job on the s390x host, so we now test both, in-tree and out-of-tree
> builds.
> 
> Fixes: 2f6fdb4ac446 ("s390x: snippets: Add snippet compilation")
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   .gitlab-ci.yml | 4 +++-
>   configure      | 4 ++++
>   s390x/Makefile | 2 +-
>   3 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 4aebb97..943b20f 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -57,7 +57,9 @@ build-ppc64le:
>   build-s390x:
>    script:
>    - dnf install -y qemu-system-s390x gcc-s390x-linux-gnu
> - - ./configure --arch=s390x --cross-prefix=s390x-linux-gnu-
> + - mkdir build
> + - cd build
> + - ../configure --arch=s390x --cross-prefix=s390x-linux-gnu-
>    - make -j2
>    - ACCEL=tcg ./run_tests.sh
>        selftest-setup intercept emulator sieve skey diag10 diag308 vector diag288
> diff --git a/configure b/configure
> index 1d4871e..1d4d855 100755
> --- a/configure
> +++ b/configure
> @@ -296,6 +296,10 @@ if test ! -e Makefile; then
>       ln -sf "$srcdir/$testdir/unittests.cfg" $testdir/
>       ln -sf "$srcdir/run_tests.sh"
>   
> +    if [ -d "$srcdir/$testdir/snippets" ]; then
> +        mkdir -p "$testdir/snippets/c"
> +    fi
> +
>       echo "linking scripts..."
>       ln -sf "$srcdir/scripts"
>   fi
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 07af26d..6565561 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -90,7 +90,7 @@ $(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(FLATLIBS)
>   	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@
>   
>   $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_asmlib) $(FLATLIBS)
> -	$(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib) $(FLATLIBS)
> +	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib) $(FLATLIBS)
>   	$(OBJCOPY) -O binary $@ $@
>   	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@
>   
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-16 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 10:52 [kvm-unit-tests PATCH] s390x: Fix out-of-tree builds Thomas Huth
2021-07-16 11:56 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).