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/internal/obj/arm: should not put instruction encoding into Reloc.Add #19811
Comments
There are actually two issues:
|
@cherrymui, do you want to fix this for Go 1.9? If not, feel free to kick it to Go 1.10. |
I'll try the I tried the assembler part. It is a bit invasive, involving change in both the assembler (writing the object file) and the linker (reading the object file). This part will not be in Go 1.9. |
Change https://golang.org/cl/69010 mentions this issue: |
The counter part, writeInt in cmd/internal/obj, writes int64s. So the reader side should also read int64s. This may cause a larger range of values being accepted, some of which should not be that large. This is probably ok: for example, for size/index/length, the very large value (due to corruption) may be well past the end and causes other errors. And we did not do much bound check anyway. One exmaple where this matters is ARM32's object file. For one type of relocation it encodes the instruction into Reloc.Add field (which itself may be problematic and worth fix) and the instruction encoding overflows int32, causing ARM32 object file being rejected by goobj (and so objdump and nm) before. Unskip ARM32 object file tests in goobj, nm, and objdump. Updates #19811. Change-Id: Ia46c2b68df5f1c5204d6509ceab6416ad6372315 Reviewed-on: https://go-review.googlesource.com/69010 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
If there's any work left here, it will need to wait for Go 1.11. |
The read of ARM object file is resolved by the CL above. |
Change https://golang.org/cl/248399 mentions this issue: |
On ARM, for a JMP/CALL relocation, the instruction bytes is encoded in Reloc.Add (issue #19811). I really hate it, but before it is fixed we have to follow the rule and emit the right bits from r.Add. Fixes #40769. Change-Id: I862e105408d344c5cc58ca9140d2e552e4364453 Reviewed-on: https://go-review.googlesource.com/c/go/+/248399 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Than McIntosh <thanm@google.com>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?Whatever the trybots for linux-arm are using
What did you do?
Built a sample file with -N -l then attempted to load it with cmd/internal/goobj:
https://go-review.googlesource.com/#/c/39230/
What did you expect to see?
honest object files.
What did you see instead?
https://storage.googleapis.com/go-build-log/e81c4c0b/linux-arm_e2ed47ce.log
The text was updated successfully, but these errors were encountered: