avo icon indicating copy to clipboard operation
avo copied to clipboard

Fails to build under architectures other than amd64

Open rogers0 opened this issue 3 years ago • 4 comments

I packaged this git into debian:

  • https://bugs.debian.org/965065
  • https://tracker.debian.org/pkg/golang-github-mmcloughlin-avo

However, it builds successfully only on amd64, but fails on other architectures:

  • https://buildd.debian.org/status/package.php?p=golang-github-mmcloughlin-avo

e.g.

  • i386 log: https://buildd.debian.org/status/fetch.php?pkg=golang-github-mmcloughlin-avo&arch=i386&ver=0.0%7Egit20200523.4439b6b-2&stamp=1595680247&raw=0
  • arm64 log: https://buildd.debian.org/status/fetch.php?pkg=golang-github-mmcloughlin-avo&arch=arm64&ver=0.0%7Egit20200523.4439b6b-2&stamp=1595680124&raw=0

It may be related to #134 Please kindly help to fix, if possible. Thank you!

rogers0 avatar Jul 25 '20 16:07 rogers0

Seems like this can be solved with some build tags to avoid trying to build the examples on non-amd64 architectures.

dgryski avatar Jul 25 '20 20:07 dgryski

@rogers0 Thanks for reaching out. As @dgryski says we may be able to fix this with build tags, however I also wonder if it's possible for you to simply not build avo for those other architectures?

The purpose of avo is a developer tool to assist with code generation for amd64 platforms. I guess someone might work on a different architecture and write assembly for amd64, but that's likely not the common use case.

Ticket https://bugs.debian.org/965065 mentions that avo is required because it's a circl dependency. Not sure if it makes a difference, but avo is a developer dependency for circl, not a runtime dependency. I actually worked with them to ensure that avo did not appear in their main go.mod. Instead, avo only appears in the go.mod files for their keccak and dilithium assembly generators.

https://github.com/cloudflare/circl/blob/d004263612c5ecc3f650012406c253276fb78585/simd/keccakf1600/internal/asm/go.mod https://github.com/cloudflare/circl/tree/b8e907cafa61319bb0cbb3987cb5ace52c9c25a4/sign/dilithium/internal/common/asm

If it's still important for avo to build on those other platforms, let me know and I'll see what I can do.

mmcloughlin avatar Jul 25 '20 23:07 mmcloughlin

@mmcloughlin @dgryski thanks for your feedback!

There're two binary package (in debian) for this source package:

  • golang-github-mmcloughlin-avo-dev (the library)
  • avo (the program)

for avo I can set it only builds on amd64 (x86 64bit), however for golang-github-mmcloughlin-avo-dev, it should be able to build in various architecture, which currently seems not.

e.g. for i386 (x86 32-bit), the build log is like:

# github.com/mmcloughlin/avo/tests/alloc/gp8
asm: invalid instruction: 00020 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/alloc/gp8/gp8.s:14)   MOVB    $8, R8
asm: invalid instruction: 00020 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/alloc/gp8/gp8.s:15)   MOVB    $9, R9
...
# github.com/mmcloughlin/avo/tests/alloc/masks
asm: asmins: illegal 64: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/alloc/masks/masks.s:7) MOVQ    $65578, AX
asm: asmins: illegal 64: 00005 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/alloc/masks/masks.s:8) MOVQ    $131114, CX
...
# github.com/mmcloughlin/avo/tests/alloc/upper32
asm: asmins: illegal 64: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/alloc/upper32/upper32.s:8) XORQ    AX, AX
asm: asmins: illegal in mode 32: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/alloc/upper32/upper32.s:8) XORQ    AX, AX (14 14)
...
# github.com/mmcloughlin/avo/tests/cast
asm: asmins: illegal 64: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/cast/cast.s:7) MOVQ    x+4(FP), AX
asm: asmins: illegal in mode 32: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/cast/cast.s:7) MOVQ    x+4(FP), AX (24 14)
...
# github.com/mmcloughlin/avo/tests/fixedbugs/issue100/minrepro
asm: asmins: illegal 64: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/fixedbugs/issue100/minrepro/minrepro.s:7)  XORQ    AX, AX
asm: asmins: illegal in mode 32: 00000 (/build/golang-github-mmcloughlin-avo-0.0~git20200523.4439b6b/obj-i686-linux-gnu/src/github.com/mmcloughlin/avo/tests/fixedbugs/issue100/minrepro/minrepro.s:7)  XORQ    AX, AX (14 14)
...

rogers0 avatar Jul 26 '20 12:07 rogers0

another one fails on i386 (x86 32-bit):

# github.com/mmcloughlin/avo/internal/gen
src/github.com/mmcloughlin/avo/internal/gen/asmtest.go:118:24: constant 9223372036854775807 overflows int

rogers0 avatar Jul 26 '20 13:07 rogers0