You are not logged in.

#1 2021-12-16 19:36:55

Arnie97
Member
Registered: 2021-11-25
Posts: 5

Remove go from the i486/i686 blacklist?

Go 1.16 did not drop pre-SSE2 processor support.
What had been removed was x87 support for pre-SSE2 processors, which means you could not utilize the hardware float instructions with Go on a Pentium MMX anymore.  The GO386=387 option was also removed, but a new option GO386=softfloat was introduced at the same time.

I did not figure out how to make asp32 work:

$ asp32 checkout go
fatal: unable to update url base from redirection:
  asked for: https://git.archlinux.org/svntogit/packages.git/info/refs?service=git-upload-pack
   redirect: https://gitlab.archlinux.org/explore/groups
error: failed to update remote packages64

So I started porting work with a PKGBUILD from my amd64 Arch install. Here are my modified PKGBUILD:

# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Daniel Martí <mvdan@mvdan.cc>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Pierre Neidhardt <ambrevar@gmail.com>
# Contributor: Vesa Kaihlavirta <vegai@iki.fi>
# Contributor: Rémy Oudompheng <remy@archlinux.org>
# Contributor: Andres Perera <andres87p gmail>
# Contributor: Matthew Bauer <mjbauer95@gmail.com>
# Contributor: Christian Himpel <chressie@gmail.com>
# Contributor: Mike Rosset <mike.rosset@gmail.com>
# Contributor: Daniel YC Lin <dlin.tw@gmail.com>
# Contributor: John Luebs <jkluebs@gmail.com>

pkgname=go
epoch=2
pkgver=1.17.5
pkgrel=1
pkgdesc='Core compiler tools for the Go programming language'
arch=(i486)
url='https://golang.org/'
license=(BSD)
makedepends=(git go perl)
replaces=(go-pie)
provides=(go-pie)
options=(!strip staticlibs)
source=(https://storage.googleapis.com/golang/go$pkgver.src.tar.gz{,.asc})
validpgpkeys=('EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796')
sha256sums=('3defb9a09bed042403195e872dcbc8c6fae1485963332279668ec52e80a95a2d'
            'SKIP')

build() {
  export GOARCH=386
  export GO386=softfloat
  export GOROOT_FINAL=/usr/lib/go
  export GOROOT_BOOTSTRAP=/usr/lib/go
  export GOPATH="$srcdir/"
  export GOROOT="$srcdir/$pkgname"

  cd "$pkgname/src"
  ./make.bash -v
}

check() {
  export GOARCH=386
  export GOROOT_FINAL=/usr/lib/go
  export GOROOT_BOOTSTRAP=/usr/lib/go
  export GOROOT="$srcdir/$pkgname"
  export GO_TEST_TIMEOUT_SCALE=3

  cd $pkgname/src
  ./run.bash --no-rebuild -v -v -v -k
}

package() {
  cd "$pkgname"

  install -d "$pkgdir/usr/bin" "$pkgdir/usr/lib/go" "$pkgdir/usr/share/doc/go" \
    "$pkgdir/usr/lib/go/pkg/linux_386_"{dynlink,race}

  cp -a bin pkg src lib misc api test "$pkgdir/usr/lib/go"
  cp -r doc/* "$pkgdir/usr/share/doc/go"

  ln -sf /usr/lib/go/bin/go "$pkgdir/usr/bin/go"
  ln -sf /usr/lib/go/bin/gofmt "$pkgdir/usr/bin/gofmt"
  ln -sf /usr/share/doc/go "$pkgdir/usr/lib/go/doc"

  install -Dm644 VERSION "$pkgdir/usr/lib/go/VERSION"

  rm -rf "$pkgdir/usr/lib/go/pkg/bootstrap" "$pkgdir/usr/lib/go/pkg/tool/*/api"

  # TODO: Figure out if really needed
  rm -rf "$pkgdir"/usr/lib/go/pkg/obj/go-build/*

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim: ts=2 sw=2 et

I chrooted into i486 Arch32 rootfs on a powerful amd64 machine, and set Architecture=pentium4 in /etc/pacman.conf to temporarily install the packaged go-2:1.17.3-1.1 as the host compiler.  Makepkg bootstrapped smoothly, and produced a fully usable i586 go compiler.
However it failed later in syscall unit tests (due to lack of permissions in chroot jail), hence I skipped the syscall test to produce a tar ball:

--- i/PKGBUILD
+++ w/PKGBUILD
@@ -49,5 +49,5 @@ check() {
   export GO_TEST_TIMEOUT_SCALE=3

   cd $pkgname/src
-  ./run.bash --no-rebuild -v -v -v -k
+  ./run.bash --no-rebuild -v -v -v -k -run "!syscall"
 }

After upgrading to the built go-2:1.17.5-1-i486.pkg.tar.zst, the pentium4 go package was automatically removed, so I connected the disk back to my MMX, and run go tool dist test --no-rebuild -v -v -v -k again there.  Not surprisingly, all syscall tests passed.

I'm aware that the go compiler never supported i486 in the history, either as the host or as the target.  The minimum hardware requirement is Pentium MMX.  But I still chose arch=(i486) in PKGBUILD, otherwise makepkg would refuse to work and complain:

==> ERROR: go is not available for the 'i486' architecture.

I did not investigate further, since I'll use the package on i586, and declare the i586 binary as i686 will not help in this case anyway smile

Last edited by Arnie97 (2021-12-16 19:46:58)

Offline

#2 2022-01-02 09:40:57

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 466
Website

Re: Remove go from the i486/i686 blacklist?

Sorry for the late answer, your post somehow got lost in my RSS notifier. :-)

Yeah, will should definitely try to build go on i486, I need it personally for hugo and yay, so.. :-)

asp32 export community/go

should work.

You can try to use the devtools32 on a 64-bit host to build in a 486 chroot with staging-i486-build,
so the test would pass, as the host has MMX, but most likely the resulting go would still contain
some non-486 stuff..

Offline

#3 2022-01-02 09:44:28

abaumann
Administrator
From: Zurich
Registered: 2019-11-14
Posts: 466
Website

Re: Remove go from the i486/i686 blacklist?

I get:

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new

go tool dist: FAILED: /build/go/src/go/pkg/tool/linux_386/compile -std -pack -o /tmp/go-tool-dist-953181481/internal/cpu/_go_.a -p internal/cpu -importcfg /tmp/go-tool-dist-953181481/internal/cpu/importcfg -asmhdr /tmp/go-tool-dist-953181481/internal/cpu/go_asm.h -symabis /tmp/go-tool-dist-953181481/internal/cpu/symabis /build/go/src/go/src/internal/cpu/cpu.go /build/go/src/go/src/internal/cpu/cpu_386.go /build/go/src/go/src/internal/cpu/cpu_x86.go: exit status 2
go tool dist: open /tmp/go-tool-dist-953181481/runtime/internal/sys/_go_.a: no such file or directory
go tool dist: open /tmp/go-tool-dist-953181481/internal/cpu/_go_.a: no such file or directory
go tool dist: open /tmp/go-tool-dist-953181481/runtime/internal/atomic/atomic_386.o: no such file or directory
/build/go/src/go/src/runtime/internal/sys/intrinsics_common.go:130:54: internal compiler error: 'LeadingZeros64': panic during regalloc while compiling LeadingZeros64:

interface conversion: ssa.Location is nil, not *        bootstrap_1cmd_1compile_1internal_1ssa      ssa.Register

goroutine 1 [running]:
bootstrap/cmd/compile/internal/ssa.Compile..func1
        /build/go/src/go/src/cmd/compile/internal/ssa/compile.go:44
panic   
        /build/gcc/src/gcc/libgo/go/runtime/panic.go:708
bootstrap_1cmd_1compile_1internal_1ssa.regAllocState.regalloc
        /build/go/src/go/src/cmd/compile/internal/ssa/regalloc.go:1571
bootstrap/cmd/compile/internal/ssa.regalloc
        /build/go/src/go/src/cmd/compile/internal/ssa/regalloc.go:148
bootstrap_1cmd_1compile_1internal_1ssa.Compile
        /build/go/src/go/src/cmd/compile/internal/ssa/compile.go:96
bootstrap/cmd/compile/internal/ssagen.buildssa
        /build/go/src/go/src/cmd/compile/internal/ssagen/ssa.go:642
bootstrap_1cmd_1compile_1internal_1ssagen.Compile
        /build/go/src/go/src/cmd/compile/internal/ssagen/pgen.go:165
bootstrap/cmd/compile/internal/gc.compileFunctions..func6
        /build/go/src/go/src/cmd/compile/internal/gc/compile.go:153
bootstrap/cmd/compile/internal/gc.compileFunctions..func2
        /build/go/src/go/src/cmd/compile/internal/gc/compile.go:125
bootstrap/cmd/compile/internal/gc.compileFunctions..func5
        /build/go/src/go/src/cmd/compile/internal/gc/compile.go:152
bootstrap/cmd/compile/internal/gc.compileFunctions
        /build/go/src/go/src/cmd/compile/internal/gc/compile.go:163
bootstrap_1cmd_1compile_1internal_1gc.Main
        /build/go/src/go/src/cmd/compile/internal/gc/main.go:287
main.main
        /build/go/src/go/src/cmd/compile/main.go:55



Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new

go tool dist: FAILED: /build/go/src/go/pkg/tool/linux_386/compile -std -pack -o /tmp/go-tool-dist-953181481/runtime/internal/sys/_go_.a -p runtime/internal/sys -importcfg /tmp/go-tool-dist-953181481/runtime/internal/sys/importcfg -asmhdr /tmp/go-tool-dist-953181481/runtime/internal/sys/go_asm.h -symabis /tmp/go-tool-dist-953181481/runtime/internal/sys/symabis /build/go/src/go/src/runtime/internal/sys/arch.go /build/go/src/go/src/runtime/internal/sys/arch_386.go /build/go/src/go/src/runtime/internal/sys/intrinsics_common.go /build/go/src/go/src/runtime/internal/sys/intrinsics_stubs.go /build/go/src/go/src/runtime/internal/sys/sys.go /build/go/src/go/src/runtime/internal/sys/zgoarch_386.go /build/go/src/go/src/runtime/internal/sys/zgoos_linux.go /build/go/src/go/src/runtime/internal/sys/zversion.go: exit status 2

Offline

Board footer

Powered by FluxBB