see https://github.com/golang/go/issues/23889
Signed-off-by: Khem Raj <raj.k...@gmail.com> --- meta/recipes-devtools/go/go-1.10.inc | 1 + .../arm64-fix-branch-too-far-with-TBZ.patch | 50 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 meta/recipes-devtools/go/go-1.10/arm64-fix-branch-too-far-with-TBZ.patch diff --git a/meta/recipes-devtools/go/go-1.10.inc b/meta/recipes-devtools/go/go-1.10.inc index 3a93773e2a..8c70de934e 100644 --- a/meta/recipes-devtools/go/go-1.10.inc +++ b/meta/recipes-devtools/go/go-1.10.inc @@ -13,6 +13,7 @@ SRC_URI += "\ file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ file://0006-cmd-dist-separate-host-and-target-builds.patch \ file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ + file://arm64-fix-branch-too-far-with-TBZ.patch \ " SRC_URI_append_libc-musl = " file://0008-ld-replace-glibc-dynamic-linker-with-musl.patch" diff --git a/meta/recipes-devtools/go/go-1.10/arm64-fix-branch-too-far-with-TBZ.patch b/meta/recipes-devtools/go/go-1.10/arm64-fix-branch-too-far-with-TBZ.patch new file mode 100644 index 0000000000..9378ede132 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.10/arm64-fix-branch-too-far-with-TBZ.patch @@ -0,0 +1,50 @@ +From 0893ca552f7dddba10d8209bd28c69f86fcd791c Mon Sep 17 00:00:00 2001 +From: Cherry Zhang <cherr...@google.com> +Date: Sat, 17 Feb 2018 10:31:39 -0500 +Subject: [PATCH] cmd/internal/obj/arm64: fix branch-too-far with TBZ like instructions + +The compiler now emits TBZ like instructions, but the assembler's +too-far-branch patch code didn't include that case. Add it. + +Fixes #23889. + +Change-Id: Ib75f9250c660b9fb652835fbc83263a5d5073dc5 +--- +Signed-off-by: Khem Raj <raj.k...@gmail.com> +Upstream-Status: Backport + +diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go +index 423f55f..38f1d24 100644 +--- a/src/cmd/internal/obj/arm64/asm7.go ++++ b/src/cmd/internal/obj/arm64/asm7.go +@@ -723,9 +723,16 @@ + o = c.oplook(p) + + /* very large branches */ +- if (o.type_ == 7 || o.type_ == 39) && p.Pcond != nil { // 7: BEQ and like, 39: CBZ and like ++ if (o.type_ == 7 || o.type_ == 39 || o.type_ == 40) && p.Pcond != nil { // 7: BEQ and like, 39: CBZ and like, 40: TBZ and like + otxt := p.Pcond.Pc - pc +- if otxt <= -(1<<18)+10 || otxt >= (1<<18)-10 { ++ var toofar bool ++ switch o.type_ { ++ case 7, 39: // branch instruction encodes 19 bits ++ toofar = otxt <= -(1<<20)+10 || otxt >= (1<<20)-10 ++ case 40: // branch instruction encodes 14 bits ++ toofar = otxt <= -(1<<15)+10 || otxt >= (1<<15)-10 ++ } ++ if toofar { + q := c.newprog() + q.Link = p.Link + p.Link = q +diff --git a/src/cmd/internal/obj/arm64/asm_test.go b/src/cmd/internal/obj/arm64/asm_test.go +index 369c48f..3e0c9c1 100644 +--- a/src/cmd/internal/obj/arm64/asm_test.go ++++ b/src/cmd/internal/obj/arm64/asm_test.go +@@ -52,6 +52,7 @@ + // gen generates a very large program, with a very far conditional branch. + func gen(buf *bytes.Buffer) { + fmt.Fprintln(buf, "TEXT f(SB),0,$0-0") ++ fmt.Fprintln(buf, "TBZ $5, R0, label") + fmt.Fprintln(buf, "CBZ R0, label") + fmt.Fprintln(buf, "BEQ label") + for i := 0; i < 1<<19; i++ { -- 2.16.2 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core