New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/link: 1.16 broken for Annapurna AL-212 and possibly other ARM chips (R_ARM_V4BX) #45012
Comments
Change https://golang.org/cl/301631 mentions this issue: |
/cc @thanm @jeremyfaller |
What vintage of C compiler are you using? R_ARM_V4BX as I understand it is an ArmV4 construct (e.g. very ancient). |
Since the ReadyNAS "firmware" is based on Debian 8 it's gcc 4.7.2 and, yes, that's quite ancient. But I was under the impression that gcc wouldn't be used at all when building with a version of go already present on the system? |
Go needs a C compiler in order to support cgo, which is enabled by default. So if you run make.bash at some point the C compiler will get invoked. You can get the behavior you refer to by using CGO_ENABLED=0 bash make.bash. |
Thanks, I have to admit that I was mislead by the output from make.bash saying "using /usr/lib/go ..." and thus didn't look further. Now, using CGO_ENABLED=0 works for building go itself on my box but what about modules/packages that rely on cgo? I guess they'd still fail without the patch to cmd/link because of gcc producing outdated ARM code? I'm aware that this is for really ancient systems but then there's a lot of those out there that can't be updated easily to a newer distro base. |
Well I think this may be getting into the philosophical realm... I think most would agree that there needs to be some sort of limit on how far back we want to go in terms of supporting older versions of things. It's just a question of where you draw the line IMO. Generally speaking when making changes to the tools (linker, compiler etc) we want to have regression tests to make sure that new changes don't break existing functionality. Having code in the linker that is only triggered by an ancient compiler is problematic in that if we wanted to have a test, we'd need to have a builder with a C compiler that produces something that will cause the code to run ... this is obviously how this got broken here in the first place. |
Go has required ARMv5+ since a long time ago. I don't think we'll add ARMv4 support back. If the system and the C toolchain are both ancient, it probably works better with a version of Go that is as ancient. Thanks. |
I totally agree. As I tried to point out I was under the impression that some part of the go toolchain was responsible for generating the R_ARM_V4BX (stupid in hindsight). That's why I submitted the PR. As long as I can fix it for me using my own patch, I'm fine. Sorry for the troubles. |
Thanks, @RustyDust . If I read you correctly we can close this. Feel free to reopen if I'm mistaken. Thanks. |
thought met the same problem: /usr/local/Cellar/go/1.16.2/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 the code works in go version 1.15. after upgrade to 1.16.2, error happen. |
@dididudu998 this looks like a different problem. Could you file a new issue? It would be helpful if you provide what command you run and the full error output. If possible, do |
@RustyDust (posting for posterity): your patch applied to |
What version of Go are you using (
go version
)?Currently I'm using 1.15.8 which I compiled on my Netgear ReadyNAS RN204 that is using an Annapurna AL-212 chip.
When trying to build 1.16.x (tried with 1.16 and 1.16.2) I ran into compile problems, telling me about
unexpected relocation type 296 (R_ARM_V4BX)
Does this issue reproduce with the latest release?
Yes.
Inspection of the code in question showed that the linker code handling R_ARM_V4BX was removed between 1.15.x and 1.16.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
A working build.
What did you see instead?
Go 1.16 and 1.16.2 won't build, see above.
The text was updated successfully, but these errors were encountered: