Skip to contentSkip to conversation

lm32: convert to new common tcg infrastructure

RFC PATCH In review Michael Walle 2 participants 8 messages Jan 31, 2019 – Feb 1, 2019

lore
Share & tools
lore
#0 lore raw

cover lm32: convert to new common tcg infrastructure

The main problem here is, that there is no prebuilt compiler packages. Thus I have to build the toolchain from scratch. I don't know if this is OK in the docker image. For now only binutils is built. But then, I'll have to pass the LD and AS environment variables, too. And it won't work with the native host cross toolchain - unless we'll probe for the assembler and linker, too.

Any ideas?

Michael Walle (3):
tests/docker: add debian-lm32-cross image
tests/tcg: also pass AS and LD variables
tests/tcg/lm32: enable system tests

 tests/docker/Makefile.include                     |   5 +-
 tests/docker/dockerfiles/debian-lm32-cross.docker |  31 +++++++
 tests/tcg/Makefile.include                        |  13 ++-
 tests/tcg/lm32/Makefile                           | 106 ----------------------
 tests/tcg/lm32/Makefile.include                   |   8 ++
 tests/tcg/lm32/Makefile.softmmu-target            |  33 +++++++
 6 files changed, 86 insertions(+), 110 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-lm32-cross.docker
 delete mode 100644 tests/tcg/lm32/Makefile
 create mode 100644 tests/tcg/lm32/Makefile.include
 create mode 100644 tests/tcg/lm32/Makefile.softmmu-target
Signature · 1 line
2.11.0
#1 lore raw

RFC PATCH 1/3 tests/docker: add debian-lm32-cross image

Unfortunately, there is no debian package for the lm32 toolchain. To keep the build times short, only build the binutils from scratch.

---
 tests/docker/Makefile.include                     |  5 ++--
 tests/docker/dockerfiles/debian-lm32-cross.docker | 31 +++++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-lm32-cross.docker
tests/docker/Makefile.include +3 -2
index 0b9c8828e1..055bfc594d 100644
@@ -90,6 +90,7 @@ docker-image-debian-amd64: docker-image-debian9
 docker-image-debian-armel-cross: docker-image-debian9
 docker-image-debian-armhf-cross: docker-image-debian9
 docker-image-debian-arm64-cross: docker-image-debian9
+docker-image-debian-lm32-cross: docker-image-debian9
 docker-image-debian-mips-cross: docker-image-debian9
 docker-image-debian-mipsel-cross: docker-image-debian9
 docker-image-debian-mips64el-cross: docker-image-debian9
@@ -114,8 +115,8 @@ docker-image-tricore-cross: docker-image-debian9
 # These images may be good enough for building tests but not for test builds
 DOCKER_PARTIAL_IMAGES += debian-alpha-cross debian-hppa-cross debian-m68k-cross debian-sh4-cross
 DOCKER_PARTIAL_IMAGES += debian-sparc64-cross debian-mips64-cross debian-riscv64-cross
-DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross fedora-i386-cross
-DOCKER_PARTIAL_IMAGES += fedora-cris-cross
+DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross debian-lm32-cross
+DOCKER_PARTIAL_IMAGES += fedora-i386-cross fedora-cris-cross
 
 # Rules for building linux-user powered images
 #
tests/docker/dockerfiles/debian-lm32-cross.docker new file +31 -0
new file mode 100644
index 0000000000..1114d8ac6d
@@ -0,0 +1,31 @@
+#
+# Docker LatticeMico32 cross-compiler target
+#
+# This docker target builds on the debian Stretch base image.
+#
+# Copyright (c) 2019 Michael Walle
+# Copyright (c) 2018 Philippe Mathieu-Daudé
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+FROM qemu:debian9
+
+MAINTAINER Michael Walle <[email protected]>
+
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        wget
+
+ENV BINUTILS_VERSION 2.31
+
+RUN wget http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz && \
+    tar -xJf binutils-$BINUTILS_VERSION.tar.xz -C /usr/src && \
+    cd /usr/src/binutils-$BINUTILS_VERSION && \
+    ./configure --prefix=/usr --disable-nls --target=lm32-elf && \
+    make && make install && \
+    rm -rf /usr/src/binutils-$BINUTILS_VERSION
+
+# This image isn't designed for building QEMU but building tests
+ENV QEMU_CONFIGURE_OPTS --disable-system --disable-user
Signature · 1 line
2.11.0
#2 lore raw

Re: [Qemu-devel] [RFC PATCH 1/3] tests/docker: add debian-lm32-cross image

Quoted 23 lines · Michael Walle

Unfortunately, there is no debian package for the lm32 toolchain. To keep the build times short, only build the binutils from scratch.

---
 tests/docker/Makefile.include                     |  5 ++--
 tests/docker/dockerfiles/debian-lm32-cross.docker | 31 +++++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-lm32-cross.docker
tests/docker/Makefile.include +1 -0
index 0b9c8828e1..055bfc594d 100644
@@ -90,6 +90,7 @@ docker-image-debian-amd64: docker-image-debian9
 docker-image-debian-armel-cross: docker-image-debian9
 docker-image-debian-armhf-cross: docker-image-debian9
 docker-image-debian-arm64-cross: docker-image-debian9
+docker-image-debian-lm32-cross: docker-image-debian9
 docker-image-debian-mips-cross: docker-image-debian9
 docker-image-debian-mipsel-cross: docker-image-debian9
 docker-image-debian-mips64el-cross: docker-image-debian9

tests/docker/Makefile.include docker-image-tricore-cross: docker-image-debian9 · line 119

Quoted 7 lines
tests/docker/Makefile.include +2 -2
@@ -114,8 +115,8 @@ docker-image-tricore-cross: docker-image-debian9
 # These images may be good enough for building tests but not for test builds
 DOCKER_PARTIAL_IMAGES += debian-alpha-cross debian-hppa-cross debian-m68k-cross debian-sh4-cross
 DOCKER_PARTIAL_IMAGES += debian-sparc64-cross debian-mips64-cross debian-riscv64-cross
-DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross fedora-i386-cross
-DOCKER_PARTIAL_IMAGES += fedora-cris-cross
+DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross debian-lm32-cross
+DOCKER_PARTIAL_IMAGES += fedora-i386-cross fedora-cris-cross

I've been looking at this for the linux-user stuff. I suspect we want another class of images (DOCKER_SRC_BUILD_IMAGES?) so we can decide if they get built. It's probably time we start moving the dockerfiles into appropriate subdirs rather than treating them all as one monolithic set.

Quoted 10 lines
tests/docker/Makefile.include +0 -0
 # Rules for building linux-user powered images
 #
tests/docker/dockerfiles/debian-lm32-cross.docker new file +1 -0
new file mode 100644
index 0000000000..1114d8ac6d
@@ -0,0 +1,31 @@
+#

tests/docker/dockerfiles/debian-lm32-cross.docker line 11

Quoted 10 lines
tests/docker/dockerfiles/debian-lm32-cross.docker new file +10 -0
+# Docker LatticeMico32 cross-compiler target
+#
+# This docker target builds on the debian Stretch base image.
+#
+# Copyright (c) 2019 Michael Walle
+# Copyright (c) 2018 Philippe Mathieu-Daudé
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+FROM qemu:debian9

Have you looked at:

https://docs.docker.com/develop/develop-images/multistage-build/

It would be nice if we could split the build from the final artefact image. That way the interim can be thrown away after a successful build.

Quoted 10 lines
tests/docker/dockerfiles/debian-lm32-cross.docker new file +10 -0
+
+MAINTAINER Michael Walle <[email protected]>
+
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt-get install -y --no-install-recommends \
+        wget
+
+ENV BINUTILS_VERSION 2.31

tests/docker/dockerfiles/debian-lm32-cross.docker line 31

Quoted 10 lines
tests/docker/dockerfiles/debian-lm32-cross.docker new file +10 -0
+
+RUN wget http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz && \
+    tar -xJf binutils-$BINUTILS_VERSION.tar.xz -C /usr/src && \
+    cd /usr/src/binutils-$BINUTILS_VERSION && \
+    ./configure --prefix=/usr --disable-nls --target=lm32-elf && \
+    make && make install && \
+    rm -rf /usr/src/binutils-$BINUTILS_VERSION
+
+# This image isn't designed for building QEMU but building tests
+ENV QEMU_CONFIGURE_OPTS --disable-system --disable-user

--
Alex Bennée

#3 lore raw

RFC PATCH 2/3 tests/tcg: also pass AS and LD variables

In reply to Michael Walle

The lm32 architecture doesn't need the complete compiler. In fact, only the building of GCC is skipped to make building the docker image faster.

---
 tests/tcg/Makefile.include | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tests/tcg/Makefile.include +11 -2
index 73b5626fc5..19b81400f5 100644
@@ -41,17 +41,26 @@ ifneq ($(DOCKER_IMAGE),)
 # We also need the Docker make rules to depend on
 include $(SRC_PATH)/tests/docker/Makefile.include
 
-DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+DOCKER_CC_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
 		--cc $(DOCKER_CROSS_COMPILER) \
 		-i qemu:$(DOCKER_IMAGE) \
 		-s $(SRC_PATH) -- "
+DOCKER_AS_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_ASSEMBLER) \
+		-i qemu:$(DOCKER_IMAGE) \
+		-s $(SRC_PATH) -- "
+DOCKER_LD_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_LINKER) \
+		-i qemu:$(DOCKER_IMAGE) \
+		-s $(SRC_PATH) -- "
 DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
 
 .PHONY: docker-build-guest-tests
 docker-build-guest-tests: $(DOCKER_PREREQ)
 	$(call quiet-command, \
 	  (mkdir -p tests && cd tests && \
-	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_CC_CMD) \
+			AS=$(DOCKER_AS_CMD) LD=$(DOCKER_LD_CMD) \
 			BUILD_STATIC=y \
 			EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
 	"BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
Signature · 1 line
2.11.0
#4 lore raw

Re: [Qemu-devel] [RFC PATCH 2/3] tests/tcg: also pass AS and LD variables

Quoted 28 lines · Michael Walle

The lm32 architecture doesn't need the complete compiler. In fact, only the building of GCC is skipped to make building the docker image faster.

---
 tests/tcg/Makefile.include | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tests/tcg/Makefile.include +8 -1
index 73b5626fc5..19b81400f5 100644
@@ -41,17 +41,26 @@ ifneq ($(DOCKER_IMAGE),)
 # We also need the Docker make rules to depend on
 include $(SRC_PATH)/tests/docker/Makefile.include
 
-DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+DOCKER_CC_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
 		--cc $(DOCKER_CROSS_COMPILER) \
 		-i qemu:$(DOCKER_IMAGE) \
 		-s $(SRC_PATH) -- "
+DOCKER_AS_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_ASSEMBLER) \
+		-i qemu:$(DOCKER_IMAGE) \
+		-s $(SRC_PATH) -- "
+DOCKER_LD_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_LINKER) \
+		-i qemu:$(DOCKER_IMAGE) \

tests/tcg/Makefile.include ifneq ($(DOCKER_IMAGE),) · line 63

Quoted 10 lines
tests/tcg/Makefile.include +3 -1
+		-s $(SRC_PATH) -- "
 DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
 
 .PHONY: docker-build-guest-tests
 docker-build-guest-tests: $(DOCKER_PREREQ)
 	$(call quiet-command, \
 	  (mkdir -p tests && cd tests && \
-	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_CC_CMD) \
+			AS=$(DOCKER_AS_CMD) LD=$(DOCKER_LD_CMD) \

Hmm will these overrides break exiting builds? We haven't defined DOCKER_CROSS_ASSEMBLER or DOCKER_CROSS_LINKER for all our targets.

tests/tcg/Makefile.include ifneq ($(DOCKER_IMAGE),) · line 66

Quoted 3 lines
tests/tcg/Makefile.include +0 -0
 			BUILD_STATIC=y \
 			EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
 	"BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

--
Alex Bennée

#5 lore raw

Re: [Qemu-devel] [RFC PATCH 2/3] tests/tcg: also pass AS and LD variables

Am 1. Februar 2019 18:31:46 MEZ schrieb "Alex Bennée" <[email protected]>:

Quoted 36 lines
Quoted 1 line · Michael Walle

The lm32 architecture doesn't need the complete compiler. In fact,

only

Quoted 1 line

the building of GCC is skipped to make building the docker image

faster.

Quoted 29 lines
---
 tests/tcg/Makefile.include | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tests/tcg/Makefile.include +9 -1
index 73b5626fc5..19b81400f5 100644
@@ -41,17 +41,26 @@ ifneq ($(DOCKER_IMAGE),)
 # We also need the Docker make rules to depend on
 include $(SRC_PATH)/tests/docker/Makefile.include
 
-DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+DOCKER_CC_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
 		--cc $(DOCKER_CROSS_COMPILER) \
 		-i qemu:$(DOCKER_IMAGE) \
 		-s $(SRC_PATH) -- "
+DOCKER_AS_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_ASSEMBLER) \
+		-i qemu:$(DOCKER_IMAGE) \
+		-s $(SRC_PATH) -- "
+DOCKER_LD_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
+		--cc $(DOCKER_CROSS_LINKER) \
+		-i qemu:$(DOCKER_IMAGE) \
+		-s $(SRC_PATH) -- "
 DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
 
Quoted 10 lines

tests/tcg/Makefile.include ifneq ($(DOCKER_IMAGE),) · line 63

Quoted 7 lines
tests/tcg/Makefile.include +2 -1
 .PHONY: docker-build-guest-tests
 docker-build-guest-tests: $(DOCKER_PREREQ)
 	$(call quiet-command, \
 	  (mkdir -p tests && cd tests && \
-	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+	   $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_CC_CMD) \
+			AS=$(DOCKER_AS_CMD) LD=$(DOCKER_LD_CMD) \

Hmm will these overrides break exiting builds? We haven't defined DOCKER_CROSS_ASSEMBLER or DOCKER_CROSS_LINKER for all our targets.

it's just an RFC and not intended to be used as is.. actually I'd prefer to use the gcc. but I guess it makes the Travis ci run too long. I'd hoped there will be other ideas.. if we go with the linker and assembler variables, these should only be set if the architecture make includes will setup the variables correctly.

Signature · 1 line
-michael
#6 lore raw

RFC PATCH 3/3 tests/tcg/lm32: enable system tests

In reply to Michael Walle

Convert the existing to the new common cross build infrastructure.

---
 tests/tcg/lm32/Makefile                | 106 ---------------------------------
 tests/tcg/lm32/Makefile.include        |   8 +++
 tests/tcg/lm32/Makefile.softmmu-target |  33 ++++++++++
 3 files changed, 41 insertions(+), 106 deletions(-)
 delete mode 100644 tests/tcg/lm32/Makefile
 create mode 100644 tests/tcg/lm32/Makefile.include
 create mode 100644 tests/tcg/lm32/Makefile.softmmu-target
tests/tcg/lm32/Makefile deleted +0 -106
deleted file mode 100644
index 57e7363b2c..0000000000
@@ -1,106 +0,0 @@
--include ../../../config-host.mak
-
-CROSS=lm32-elf-
-
-SIM = qemu-system-lm32
-SIMFLAGS = -M lm32-evr -nographic -semihosting -net none -kernel
-
-CC      = $(CROSS)gcc
-AS      = $(CROSS)as
-AS      = $(CC) -x assembler
-SIZE    = $(CROSS)size
-LD      = $(CC)
-OBJCOPY = $(CROSS)objcopy
-
-TSRC_PATH = $(SRC_PATH)/tests/tcg/lm32
-
-LDFLAGS = -T$(TSRC_PATH)/linker.ld
-ASFLAGS += -Wa,-I,$(TSRC_PATH)/
-
-CRT        = crt.o
-HELPER     = helper.o
-TESTCASES += test_add.tst
-TESTCASES += test_addi.tst
-TESTCASES += test_and.tst
-TESTCASES += test_andhi.tst
-TESTCASES += test_andi.tst
-TESTCASES += test_b.tst
-TESTCASES += test_be.tst
-TESTCASES += test_bg.tst
-TESTCASES += test_bge.tst
-TESTCASES += test_bgeu.tst
-TESTCASES += test_bgu.tst
-TESTCASES += test_bi.tst
-TESTCASES += test_bne.tst
-TESTCASES += test_break.tst
-TESTCASES += test_bret.tst
-TESTCASES += test_call.tst
-TESTCASES += test_calli.tst
-TESTCASES += test_cmpe.tst
-TESTCASES += test_cmpei.tst
-TESTCASES += test_cmpg.tst
-TESTCASES += test_cmpgi.tst
-TESTCASES += test_cmpge.tst
-TESTCASES += test_cmpgei.tst
-TESTCASES += test_cmpgeu.tst
-TESTCASES += test_cmpgeui.tst
-TESTCASES += test_cmpgu.tst
-TESTCASES += test_cmpgui.tst
-TESTCASES += test_cmpne.tst
-TESTCASES += test_cmpnei.tst
-TESTCASES += test_divu.tst
-TESTCASES += test_eret.tst
-TESTCASES += test_lb.tst
-TESTCASES += test_lbu.tst
-TESTCASES += test_lh.tst
-TESTCASES += test_lhu.tst
-TESTCASES += test_lw.tst
-TESTCASES += test_modu.tst
-TESTCASES += test_mul.tst
-TESTCASES += test_muli.tst
-TESTCASES += test_nor.tst
-TESTCASES += test_nori.tst
-TESTCASES += test_or.tst
-TESTCASES += test_ori.tst
-TESTCASES += test_orhi.tst
-#TESTCASES += test_rcsr.tst
-TESTCASES += test_ret.tst
-TESTCASES += test_sb.tst
-TESTCASES += test_scall.tst
-TESTCASES += test_sextb.tst
-TESTCASES += test_sexth.tst
-TESTCASES += test_sh.tst
-TESTCASES += test_sl.tst
-TESTCASES += test_sli.tst
-TESTCASES += test_sr.tst
-TESTCASES += test_sri.tst
-TESTCASES += test_sru.tst
-TESTCASES += test_srui.tst
-TESTCASES += test_sub.tst
-TESTCASES += test_sw.tst
-#TESTCASES += test_wcsr.tst
-TESTCASES += test_xnor.tst
-TESTCASES += test_xnori.tst
-TESTCASES += test_xor.tst
-TESTCASES += test_xori.tst
-
-all: build
-
-%.o: $(TSRC_PATH)/%.c
-	$(CC) $(CFLAGS) -c $< -o $@
-
-%.o: $(TSRC_PATH)/%.S
-	$(AS) $(ASFLAGS) -c $< -o $@
-
-%.tst: %.o $(TSRC_PATH)/macros.inc $(CRT) $(HELPER)
-	$(LD) $(LDFLAGS) $(NOSTDFLAGS) $(CRT) $(HELPER) $< -o $@
-
-build: $(TESTCASES)
-
-check: $(TESTCASES:test_%.tst=check_%)
-
-check_%: test_%.tst
-	@$(SIM) $(SIMFLAGS) $<
-
-clean:
-	$(RM) -fr $(TESTCASES) $(CRT) $(HELPER)
tests/tcg/lm32/Makefile.include new file +8 -0
new file mode 100644
index 0000000000..f36f23031d
@@ -0,0 +1,8 @@
+#
+# Makefile.include for all CRIS targets
+#
+
+DOCKER_IMAGE=debian-lm32-cross
+DOCKER_CROSS_COMPILER=lm32-elf-gcc
+DOCKER_CROSS_ASSEMBLER=lm32-elf-as
+DOCKER_CROSS_LINKER=lm32-elf-ld
tests/tcg/lm32/Makefile.softmmu-target new file +33 -0
new file mode 100644
index 0000000000..71a1a1802b
@@ -0,0 +1,33 @@
+#
+# lm32 softmmu tests
+#
+
+LM32_SRC = $(SRC_PATH)/tests/tcg/lm32
+LM32_ALL = $(wildcard $(LM32_SRC)/test_*.S)
+LM32_TESTS = $(patsubst $(LM32_SRC)/%.S, %, $(LM32_ALL))
+# Filter out common blobs and broken tests
+LM32_BROKEN_TESTS =
+LM32_USABLE_TESTS = $(filter-out $(LM32_BROKEN_TESTS), $(LM32_TESTS))
+LM32_RUNS = $(patsubst %, run-%, $(LM32_USABLE_TESTS))
+
+# add to the list of tests
+TESTS += $(LM32_USABLE_TESTS)
+VPATH += $(LM32_SRC)
+
+QEMU_OPTS = -M lm32-evr -nographic -semihosting -net none -serial none -monitor none -kernel
+
+INCLUDE_DIRS = $(SRC_PATH)/tests/tcg/lm32
+LM32_INC = $(addprefix -I,$(INCLUDE_DIRS))
+
+LDFLAGS = -T$(SRC_PATH)/tests/tcg/lm32/linker.ld
+
+CRT        = crt.o helper.o
+
+$(LM32_USABLE_TESTS): macros.inc $(CRT) Makefile.softmmu-target
+
+# special rule for common blobs
+%.o: %.S
+	$(AS) $(LM32_INC) $(ASFLAGS) -c $< -o $@
+
+%: %.o
+	$(LD) $(LM32_INC) $< -o $@ $(LDFLAGS) $(CRT)
Signature · 1 line
2.11.0
#7 lore raw
In reply to Michael Walle
Quoted 3 lines · Michael Walle

The main problem here is, that there is no prebuilt compiler packages. Thus I have to build the toolchain from scratch. I don't know if this is OK in the docker image.

Well you only have to do it the once - certainly I can't imagine a TCG developer that hasn't built one or two toolchains in their time. Daniel has been looking at getting our developer images hosted so that would lower the cost as well.

I don't think it's a blocker.

Quoted 4 lines

For now only binutils is built. But then, I'll have to
pass the LD and AS environment variables, too. And it won't work with the native host cross toolchain - unless we'll probe for the assembler and linker, too.

When I did the original work I tried quite hard to keep to using CC for everything (as an assembler and linker frontend). I think if it's going to be difficult to keep doing that we'll want to pass a prefix env variable to the images instead of piling on more variables. Something like CROSS_COMPILE or CROSS_PREFIX. However that throws a bit of a spanner in the works for my future plans of building larger test binaries without having to deal with autoconf madness.

Quoted 1 line

Any ideas?

So a couple of ideas:

- set CROSS_PREFIX and modify our submakes to pick that up if set
- pass CROSS_PREFIX to docker.py and it expands CC/LD/AS for us

I'm open to other approaches though.

Quoted 6 lines

Michael Walle (3):
tests/docker: add debian-lm32-cross image
tests/tcg: also pass AS and LD variables
tests/tcg/lm32: enable system tests

Quoted 11 lines
 tests/docker/Makefile.include                     |   5 +-
 tests/docker/dockerfiles/debian-lm32-cross.docker |  31 +++++++
 tests/tcg/Makefile.include                        |  13 ++-
 tests/tcg/lm32/Makefile                           | 106 ----------------------
 tests/tcg/lm32/Makefile.include                   |   8 ++
 tests/tcg/lm32/Makefile.softmmu-target            |  33 +++++++
 6 files changed, 86 insertions(+), 110 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-lm32-cross.docker
 delete mode 100644 tests/tcg/lm32/Makefile
 create mode 100644 tests/tcg/lm32/Makefile.include
 create mode 100644 tests/tcg/lm32/Makefile.softmmu-target

--
Alex Bennée