Gerrit Bot has uploaded this change for review.
cmd/link: bring back R_ARM_V4BX for Annapurna AL-212 and possibly others
When trying to upgrade Go from 1.15.8 to 1.16 on my Netgear ReadyNAS RN204 and
it's Annapurna AL-212 ARM chip I ran into a compile time error:
$ cd src
go-go1.16.2/$ cd src
go-go1.16.2/src$ ./make.bash
Building Go cmd/dist using /usr/lib/go-1.15. (go1.15.8 linux/arm)
Building Go toolchain1 using /usr/lib/go-1.16.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/arm.
net(.text): unexpected relocation type 296 (R_ARM_V4BX)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x115a84]
Inspection of the changes showed that the code for handling R_ARM_V4BX that
was included in 1.15.x is mossing from 1.16 onwards. Since R_ARM_v4BX is
essentially a no-op accoring to the comment in the 1.15 tree I thought it
safe to just let it do that.
Using the patch I was able to build a working go 1.16.2, run the test suite
and build some apps for testing.
However, with me lacking deeper understanding of the code I have no idea
about possible side effects or whether there's an easier way to handle
this. So I'd be more than happy if someone with more knowledge could give
this a look.
This PR will be imported into Gerrit with the title and first
comment (this text) used to generate the subject and body of
the Gerrit change.
Change-Id: Id1d3f8c424fc47fb2e9c2cddc7887c1afdb73047
GitHub-Last-Rev: 51ad3918e4563b072543ebed3a7012047a526d0d
GitHub-Pull-Request: golang/go#44998
---
M src/cmd/link/internal/arm/asm.go
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/cmd/link/internal/arm/asm.go b/src/cmd/link/internal/arm/asm.go
index 03caeae..32ff6e4 100644
--- a/src/cmd/link/internal/arm/asm.go
+++ b/src/cmd/link/internal/arm/asm.go
@@ -189,6 +189,12 @@
su.SetRelocType(rIdx, objabi.R_ADDR)
return true
+ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_ARM_V4BX):
+ if targType == sym.SDYNIMPORT {
+ ldr.Errorf(s, "unexpected R_ARM_V4BX relocation for dynamic symbol %s", ldr.SymName(targ))
+ }
+ return true
+
case objabi.ElfRelocOffset + objabi.RelocType(elf.R_ARM_PC24),
objabi.ElfRelocOffset + objabi.RelocType(elf.R_ARM_JUMP24):
su := ldr.MakeSymbolUpdater(s)
To view, visit change 301631. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Ian Lance Taylor, Russ Cox, Cherry Zhang.
Patch set 1:Run-TryBot +1Trust +1
2 comments:
Commit Message:
This PR will be imported into Gerrit with the title and first
comment (this text) used to generate the subject and body of
the Gerrit change.
nit: remove this, and replace with "Fixes #NNNN." after filing an issue.
Patchset:
It seems like this should be backported to the Go 1.16 release branch and included in Go 1.16.3. Can you please file an issue for this at golang.org/issue/new so we can mark it for backport? Thanks.
To view, visit change 301631. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Ian Lance Taylor, Russ Cox, Cherry Zhang.
Gerrit Bot uploaded patch set #2 to this change.
Fixes #45012
Change-Id: Id1d3f8c424fc47fb2e9c2cddc7887c1afdb73047
GitHub-Last-Rev: 22f41ab73dcf2c28e4b3d9e3e71ae0c6d65531eb
GitHub-Pull-Request: golang/go#44998
---
M src/cmd/link/internal/arm/asm.go
1 file changed, 6 insertions(+), 0 deletions(-)
To view, visit change 301631. To unsubscribe, or for help writing mail filters, visit settings.