Page MenuHomeFreeBSD

lang/go-devel: Add support for aarch64
ClosedPublic

Authored by dmgk on Nov 11 2019, 3:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Fri, Mar 15, 10:10 PM
Unknown Object (File)
Tue, Mar 12, 2:37 AM
Subscribers

Details

Summary

AArch64 support was recently merged by the Go project and is slated to be in
go1.14. This patch adds freebsd/arm64 support to lang/go-devel first, the
intention is to similarly update lang/go when go1.14 is officially released.

The most notable change is migration to the new bootstrap [1] because aarch64
is not supported by go1.4.

[1] https://github.com/dmgk/go-bootstrap

Test Plan

Tested on amd64, i386 and aarch64 (12.1-STABLE eef4ba7(master) GENERIC arm64
on RPI3)

Ports can be tested on real hardware by setting GO_PORT=lang/go-devel (building under qemu-user is currently not possible due to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240037).

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dmgk added a reviewer: jlaffaye.
lang/go-devel/Makefile
27 ↗(On Diff #64182)

leading space?

67 ↗(On Diff #64182)

leading space?

69 ↗(On Diff #64182)

same here

Add dependency on devel/binutils on aarch64 - Go needs ld.bfd for working cgo.

In D22316#488073, @dmgk wrote:

Add dependency on devel/binutils on aarch64 - Go needs ld.bfd for working cgo.

Why? Is this also the case on other archs? If it is needed to get a functional toolchain should it be optional?

! In D22316#488910, @tobik wrote:
Why? Is this also the case on other archs? If it is needed to get a functional toolchain should it be optional?

Yes there are bugs in lld8 and lld9, the test suite fails with cgo enabled. These bugs are fixed in lld10 (devel/llvm-devel) : https://github.com/golang/go/issues/35197
AFAICT it only affects aarch64

lang/go-devel/Makefile
38 ↗(On Diff #64203)

I'm not sure adding only one option is useful, either put an hard dep on binutils or add llvm-devel as an option. I'd prefer an hard dep on binutils.

In D22316#488073, @dmgk wrote:

Add dependency on devel/binutils on aarch64 - Go needs ld.bfd for working cgo.

Why? Is this also the case on other archs? If it is needed to get a functional toolchain should it be optional?

No, it is needed only on aarch64 and only for cgo. Other archs are OK with base lld as far as I know.

The rationale behind making it an option is that GNU ld is needed only for cgo which itself is not required for most Go programs,
so if someone wants to keep their arm64 env lean, well, there's option for that.

In D22316#488921, @mikael.urankar_gmail.com wrote:

Yes there are bugs in lld8 and lld9, the test suite fails with cgo enabled. These bugs are fixed in lld10 (devel/llvm-devel) : https://github.com/golang/go/issues/35197
AFAICT it only affects aarch64

Ok.

In D22316#488932, @dmgk wrote:

The rationale behind making it an option is that GNU ld is needed only for cgo which itself is not required for most Go programs,
so if someone wants to keep their arm64 env lean, well, there's option for that.

Fair enough.

Ports can be tested on real hardware by setting GO_PORT=lang/go-devel

When will Go 1.14 come out? Can we unlock binary packages for Go ports on aarch64 in the mean time with something like

GO_PORT_aarch64=	lang/go-devel
GO_PORT?=	${GO_PORT_${ARCH}:Ulang/go}

in Mk/Uses/go.mk?

(building under qemu-user is currently not possible due to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240037).

In that case go-devel probably needs the QEMU_EMULATING IGNORE too like lang/go.

lang/go-devel/Makefile
63 ↗(On Diff #64203)

${ECHO_CMD}

  • Lets keep it simple, remove BFD knob and add hard RUN/TEST dep on devel/binutils on aarch64
  • Disable building under qemu-user
  • Add missing GOARM variable
  • Update to the current master
dmgk marked 4 inline comments as done.Nov 15 2019, 1:28 PM
This revision is now accepted and ready to land.Nov 15 2019, 1:47 PM
lang/go-devel/Makefile
26–29 ↗(On Diff #64367)
RUN_DEPENDS_aarch64=	binutils>0:devel/binutils
TEST_DEPENDS_aarch64=	binutils>0:devel/binutils

AFAICT devel/binutils does not install a binutils binary.

This revision now requires review to proceed.Nov 15 2019, 1:57 PM
This revision is now accepted and ready to land.Nov 15 2019, 1:58 PM
dmgk marked an inline comment as done.Nov 15 2019, 1:58 PM
dmgk added inline comments.
lang/go-devel/Makefile
26–29 ↗(On Diff #64367)

Ah yes, thanks for catching.

dmgk marked an inline comment as done.Nov 15 2019, 2:01 PM

When will Go 1.14 come out? Can we unlock binary packages for Go ports on aarch64 in the mean time with something like

GO_PORT_aarch64=	lang/go-devel
GO_PORT?=	${GO_PORT_${ARCH}:Ulang/go}

in Mk/Uses/go.mk?

Good idea, will submit a review shortly.

This revision was automatically updated to reflect the committed changes.