Skip to content

cmd/compile: arm64 cross-compilation errors "branch too far" #12540

@matt2909

Description

@matt2909

When using go1.5 to cross compile a large body of code on amd64/linux and targetting GOOS=linux GOARCH=arm64 I am getting the following errors:

00012 (my_code.go:246) BEQ 2907044
other_code.go:1: branch too far
00032 (my_code.go:246) BLS 2907044
other_code.go:1: branch too far
00224 (my_code.go:7) BNE 2907016
other_code.go:1: branch too far
00284 (my_code.go:8) BNE 2906988
other_code.go:1: branch too far
00344 (my_code.go:9) BNE 2906960
other_code.go:1: branch too far
00404 (my_code.go:10) BNE 2906932
other_code.go:1: branch too far
00464 (my_code.go:11) BNE 2906904
other_code.go:1: branch too far
00524 (my_code.go:12) BNE 2906876
other_code.go:1: branch too far
00584 (my_code.go:13) BNE 2906848
other_code.go:1: branch too far
00644 (my_code.go:14) BNE 2906820
other_code.go:1: too many errors

The code in question (name anonymised in this dump), is basically building a big slice of function pointers. Each function pointer points to a closure. The closure is generated within the same package, but there are a lot of closures (>5000).

This looks odd, the asm7.go code is being called with pc relative offsets greater than 19 bits. Happy to dig a bit further if someone can point me in the correct direction.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions