Skip to contentSkip to conversation

s390x: Fix out-of-tree builds

PATCH Applied Thomas Huth 2 participants 2 messages Jul 16, 2021 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x: Fix out-of-tree builds

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")
---
 .gitlab-ci.yml | 4 +++-
 configure      | 4 ++++
 s390x/Makefile | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
.gitlab-ci.yml +3 -1
index 4aebb97..943b20f 100644
@@ -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
configure +4 -0
index 1d4871e..1d4d855 100755
@@ -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
s390x/Makefile +1 -1
index 07af26d..6565561 100644
@@ -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" $@ $@
 
Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw
Quoted 55 lines · Thomas Huth

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")
---
  .gitlab-ci.yml | 4 +++-
  configure      | 4 ++++
  s390x/Makefile | 2 +-
  3 files changed, 8 insertions(+), 2 deletions(-)
.gitlab-ci.yml +3 -1
index 4aebb97..943b20f 100644
@@ -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
configure +4 -0
index 1d4871e..1d4d855 100755
@@ -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
s390x/Makefile +0 -0
index 07af26d..6565561 100644

s390x/Makefile $(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(FLATLIBS) · line 96

Quoted 8 lines
s390x/Makefile +1 -1
@@ -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