Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build under architectures other than amd64 #152

Open
rogers0 opened this issue Jul 25, 2020 · 4 comments
Open

Fails to build under architectures other than amd64 #152

rogers0 opened this issue Jul 25, 2020 · 4 comments

Comments

@rogers0
Copy link

rogers0 commented Jul 25, 2020

I packaged this git into debian:

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

e.g.

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

@dgryski
Copy link
Collaborator

dgryski commented Jul 25, 2020

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

@mmcloughlin
Copy link
Owner

@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.

@rogers0
Copy link
Author

rogers0 commented Jul 26, 2020

@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
Copy link
Author

rogers0 commented Jul 26, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants