Skip to contentSkip to conversation

docker: Add fedora-xtensa-cross image

RFC PATCH In review Philippe Mathieu-Daudé 4 participants 9 messages Jun 22, 2018

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 docker: Add fedora-xtensa-cross image

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +7 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt
Signature · 1 line
2.18.0.rc2
#1 lore raw
Quoted 21 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +0 -0
new file mode 100644
index 0000000000..6f9521520c

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 1

Quoted 1 line
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +1 -0
@@ -0,0 +1,7 @@
+FROM fedora:latest

IIRC, we decided using ':latest' is not a good idea because its meaning will change over time and lead to inconsistent results for devs. We saw this before when patchew reported failure on fedora while developers saw nothing, due to patchew having cached a ":latest" image which was different.

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 7

Quoted 6 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +6 -0
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
Quoted 16 lines · Daniel P. Berrangé
Quoted 15 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
Quoted 12 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 1

Quoted 7 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +1 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest

IIRC, we decided using ':latest' is not a good idea because its meaning will change over time and lead to inconsistent results for devs. We saw this before when patchew reported failure on fedora while developers saw nothing, due to patchew having cached a ":latest" image which was different.

I totally agree with you :)

"FROM fedora:28" works.

Quoted 12 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 7

Quoted 7 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +6 -0
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt

Regards,
Daniel

#3 lore raw
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Daniel P. Berrangé
Quoted 15 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
Quoted 12 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 1

Quoted 7 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +1 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest

IIRC, we decided using ':latest' is not a good idea because its meaning will change over time and lead to inconsistent results for devs. We saw this before when patchew reported failure on fedora while developers saw nothing, due to patchew having cached a ":latest" image which was different.

Quoted 3 lines

I totally agree with you :)

"FROM fedora:28" works.

Queued with the fedora:28 fix

Quoted 13 lines
Quoted 13 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 7

Quoted 8 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +6 -0
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt

Regards,
Daniel

--
Alex Bennée

#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 21 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +0 -0
new file mode 100644
index 0000000000..6f9521520c

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 4

Quoted 4 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +4 -0
@@ -0,0 +1,7 @@
+FROM fedora:latest
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu

Generic binutils and gcc for xtensa only (partially) make sense for build testing.
Built binaries will not work.

Signature · 2 lines
Thanks.
-- Max
#5 lore raw
Quoted 16 lines · Max Filippov
Quoted 15 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
Quoted 13 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 4

Quoted 10 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +4 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu

Generic binutils and gcc for xtensa only (partially) make sense for build testing.

OK

Quoted 1 line

Built binaries will not work.

Why?

--
Alex Bennée

#6 lore raw
Quoted 31 lines · Alex Bennée
Quoted 16 lines · Max Filippov
Quoted 15 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
Quoted 13 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 4

Quoted 10 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +4 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu

Generic binutils and gcc for xtensa only (partially) make sense for build testing.

Quoted 5 lines

OK

Quoted 1 line

Built binaries will not work.

Why?

The default toolchain does not generate code for any real xtensa CPU configuration or for any configuration supported by the QEMU. The xtensa configuration overlay for a specific CPU must be applied to the toolchain source in order to build a toolchain capable of producing code that would work on that CPU.
There's FSF xtensa CPU configuration in QEMU that is compatible with very old (older than 2.19 IIRC) binutils. xtensa TCG tests (at least some of them) are written for the dc232b xtensa CPU. The configuration overlay for that CPU is available here:

https://github.com/jcmvbkbc/xtensa-toolchain-build/blob/master/overlays/xtensa_dc232b.tar.gz

The following toolchain may be used to build working tests for xtensa:

https://github.com/foss-xtensa/toolchain/releases/download/2018.02/x86_64-2018.02-xtensa-dc232b-elf.tar.gz

Signature · 2 lines
Thanks.
-- Max
#7 lore raw
Quoted 38 lines · Max Filippov
Quoted 31 lines · Alex Bennée
Quoted 16 lines · Max Filippov
Quoted 15 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
Quoted 13 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 4

Quoted 10 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +4 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu

Generic binutils and gcc for xtensa only (partially) make sense for build testing.

Quoted 5 lines

OK

Quoted 1 line

Built binaries will not work.

Why?

Quoted 7 lines

The default toolchain does not generate code for any real xtensa CPU configuration or for any configuration supported by the QEMU. The xtensa configuration overlay for a specific CPU must be applied to the toolchain source in order to build a toolchain capable of producing code that would work on that CPU.
There's FSF xtensa CPU configuration in QEMU that is compatible with very old (older than 2.19 IIRC) binutils.

While the Fedora binutils supports dual endianness, the compiler only works for big-endian:

$ docker run --rm -it qemu:fedora-xtensa-cross xtensa-linux-gnu-objcopy
xtensa-linux-gnu-objcopy: supported targets: elf32-xtensa-le
elf32-xtensa-be elf32-little elf32-big
$ docker run --rm -it qemu:fedora-xtensa-cross bash -c \
  'echo -e "__XTENSA_EL__\n__XTENSA_EB__" | \
  xtensa-linux-gnu-gcc -E - | grep -v "\#"'
__XTENSA_EL__
1
Quoted 2 lines

xtensa TCG tests (at least
some of them) are written for the dc232b xtensa CPU. The configuration

I learned that the hard way :(

I took the only big-endian CPU available: FSF, however

- the linkscript expect the unavailable XTENSA_HAVE_BE definition,
- core-isa.h misses the following definitions:

#define XCHAL_KERNEL_VECOFS             0x00000200 /* XXX ??? */
#define XCHAL_INTLEVEL2_VECOFS          0x00000180 /* XXX ??? */
#define XCHAL_INTLEVEL3_VECOFS          0x00000240 /* XXX ??? */
#define XCHAL_INTLEVEL4_VECOFS          0x00000520 /* XXX ??? */

So this is a dead-end.

Quoted 7 lines

overlay for that CPU is available here:

https://github.com/jcmvbkbc/xtensa-toolchain-build/blob/master/overlays/xtensa_dc232b.tar.gz

The following toolchain may be used to build working tests for xtensa:

https://github.com/foss-xtensa/toolchain/releases/download/2018.02/x86_64-2018.02-xtensa-dc232b-elf.tar.gz

Thanks for the links, I'll continue with DC232B next week.

Alex: Can you dequeue this patch please?

Regards,

Phil.

#8 lore raw
Quoted 81 lines · Philippe Mathieu-Daudé
Quoted 38 lines · Max Filippov
Quoted 31 lines · Alex Bennée
Quoted 16 lines · Max Filippov
Quoted 15 lines · Philippe Mathieu-Daudé

As of this commit:

  $ xtensa-linux-gnu-as -v
  GNU assembler version 2.29.1 (xtensa-linux-gnu) using BFD version version 2.29.1-1.fc27
  $ xtensa-linux-gnu-gcc -v
  Target: xtensa-linux-gnu
  gcc version 7.2.1 20170915 (Red Hat Cross 7.2.1-1) (GCC)
---
 tests/docker/dockerfiles/fedora-xtensa-cross.docker | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-xtensa-cross.docker
Quoted 13 lines

tests/docker/dockerfiles/fedora-xtensa-cross.docker line 4

Quoted 10 lines
tests/docker/dockerfiles/fedora-xtensa-cross.docker new file +4 -0
new file mode 100644
index 0000000000..6f9521520c
@@ -0,0 +1,7 @@
+FROM fedora:latest
+ENV PACKAGES \
+    binutils-xtensa-linux-gnu \
+    gcc-xtensa-linux-gnu

Generic binutils and gcc for xtensa only (partially) make sense for build testing.

Quoted 5 lines

OK

Quoted 1 line

Built binaries will not work.

Why?

Quoted 7 lines

The default toolchain does not generate code for any real xtensa CPU configuration or for any configuration supported by the QEMU. The xtensa configuration overlay for a specific CPU must be applied to the toolchain source in order to build a toolchain capable of producing code that would work on that CPU.
There's FSF xtensa CPU configuration in QEMU that is compatible with very old (older than 2.19 IIRC) binutils.

While the Fedora binutils supports dual endianness, the compiler only works for big-endian:

$ docker run --rm -it qemu:fedora-xtensa-cross xtensa-linux-gnu-objcopy
xtensa-linux-gnu-objcopy: supported targets: elf32-xtensa-le
elf32-xtensa-be elf32-little elf32-big
$ docker run --rm -it qemu:fedora-xtensa-cross bash -c \
  'echo -e "__XTENSA_EL__\n__XTENSA_EB__" | \
  xtensa-linux-gnu-gcc -E - | grep -v "\#"'
__XTENSA_EL__
1
Quoted 2 lines

xtensa TCG tests (at least
some of them) are written for the dc232b xtensa CPU. The configuration

I learned that the hard way :(

I took the only big-endian CPU available: FSF, however

- the linkscript expect the unavailable XTENSA_HAVE_BE definition,
- core-isa.h misses the following definitions:

#define XCHAL_KERNEL_VECOFS             0x00000200 /* XXX ??? */
#define XCHAL_INTLEVEL2_VECOFS          0x00000180 /* XXX ??? */
#define XCHAL_INTLEVEL3_VECOFS          0x00000240 /* XXX ??? */
#define XCHAL_INTLEVEL4_VECOFS          0x00000520 /* XXX ??? */

So this is a dead-end.

Quoted 4 lines

overlay for that CPU is available here:

https://github.com/jcmvbkbc/xtensa-toolchain-build/blob/master/overlays/xtensa_dc232b.tar.gz

Quoted 7 lines
Quoted 3 lines

The following toolchain may be used to build working tests for xtensa:

https://github.com/foss-xtensa/toolchain/releases/download/2018.02/x86_64-2018.02-xtensa-dc232b-elf.tar.gz

Thanks for the links, I'll continue with DC232B next week.

Alex: Can you dequeue this patch please?

OK poor first choice for getting the system emulation patches working. I wonder if the other fedora compilers will be useful for us?

Quoted 4 lines

gcc-nios2-linux-gnu-7.1.1-3.fc27.i686.rpm
gcc-microblaze-linux-gnu-7.1.1-3.fc27.i686.rpm
gcc-tile-linux-gnu-7.1.1-3.fc27.i686.rpm
gcc-cris-linux-gnu-7.1.1-3.fc27.i686.rpm

--
Alex Bennée