diff mbox series

[kvm-unit-tests] s390x: Fix out-of-tree builds

Message ID 20210716105219.1201997-1-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] s390x: Fix out-of-tree builds | expand

Commit Message

Thomas Huth July 16, 2021, 10:52 a.m. UTC
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(-)

Comments

Paolo Bonzini July 16, 2021, 11:56 a.m. UTC | #1
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
diff mbox series

Patch

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" $@ $@