]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/tcg/i386: force -fno-pie for test-i386
authorAlex Bennée <alex.bennee@linaro.org>
Thu, 1 Apr 2021 10:25:25 +0000 (11:25 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Tue, 6 Apr 2021 14:04:42 +0000 (15:04 +0100)
The containerised compiler defaults to no-pie anyway but if we are
relying on the users installed cross compiler we need to check it
works for building 16 bit code first.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210401102530.12030-7-alex.bennee@linaro.org>

tests/tcg/configure.sh
tests/tcg/i386/Makefile.target

index 90fd81f50644d9db3a8d132f10719bfbdb3a5119..fa1a4261a44f8be80a0edd50b799f77499e281ef 100755 (executable)
@@ -281,6 +281,12 @@ for target in $target_list; do
                 echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
             fi
         ;;
+        i386-linux-user)
+            if do_compiler "$target_compiler" $target_compiler_cflags \
+                -Werror -fno-pie -o $TMPE $TMPC; then
+                echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak
+            fi
+        ;;
     esac
 
     enabled_cross_compilers="$enabled_cross_compilers $target_compiler"
index c4a6f91966da7ab6eb4128ac5f32f3af8f88021a..f7efaab918216070c193fe7c086bea8ce0fa63eb 100644 (file)
@@ -27,13 +27,23 @@ run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max
 hello-i386: CFLAGS+=-ffreestanding
 hello-i386: LDFLAGS+=-nostdlib
 
-#
-# test-386 includes a couple of additional objects that need to be linked together
-#
+# test-386 includes a couple of additional objects that need to be
+# linked together, we also need a no-pie capable compiler due to the
+# non-pic calls into 16-bit mode
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_I386_NOPIE),)
+test-i386: CFLAGS += -fno-pie
 
 test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386-shift.h test-i386-muldiv.h
        $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ \
           $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
+else
+test-i386:
+       $(call skip-test, "BUILD of $@", "missing -no-pie compiler support")
+run-test-i386:
+       $(call skip-test, "RUN of test-i386", "not built")
+run-plugin-test-i386-with-%:
+       $(call skip-test, "RUN of test-i386 ($*)", "not built")
+endif
 
 ifeq ($(SPEED), slow)