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: serialize Reloc.Variant field to Go object files #14218
Comments
I think I finally understand how this is supposed to work. I'm not entirely convinced it will lead to cleaner code but I'm happy to wait and see on that! I wonder if we'll be able to only have R_TLS_LE and R_TLS_IE relocs? |
CL https://golang.org/cl/20941 mentions this issue. |
Adds a new R_PCRELDBL relocation for 2-byte aligned relative relocations on s390x. Should be removed once #14218 is implemented. Change-Id: I79dd2d8e746ba8cbc26c570faccfdd691e8161e8 Reviewed-on: https://go-review.googlesource.com/20941 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Given that we seem to be changing the object file fairly freely this cycle, maybe we should just do this? |
CL https://golang.org/cl/27932 mentions this issue. |
I've sent a basic CL that does this: https://go-review.googlesource.com/#/c/27932/ It increases object file size by about 1.6%. I think it would be possible to reduce the object sizes by reducing the sizes of the types we are using for I'm not sure what other changes are planned that this could be submitted with/integrated into to minimize disruption from the object file format change. |
On 29 August 2016 at 03:20, Michael Munday notifications@github.com wrote:
You should update cmd/internal/goobj though.
Cheers, |
Should this be a proposal? What's the current state? |
I have a CL that needs some updates to improve its efficiency and demonstrate its value better. I'll try and allocate it some time this week. The change is very minor and would be fully reversible in future versions (Go makes no guarantees about object file format that I know of), so I don't know if it counts as a 'proposal'. |
@mundaym, I'm punting this to Go 1.10. Is that correct? |
SGTM |
The linker and the Go object file have gone through a major redesign. The discussion here is pretty much obsolete. It might still be helpful to serialize Reloc Variant, but I'm not sure adding a field that is used just for a small number of relocations is a good idea. Closing. If one still thinks adding Reloc Variant to the object file is helpful, feel free the send a CL and we can discuss form there. Thanks. |
In RISC architectures, address relocations usually need to
change a pair of instructions, and sometimes the fields to
stuff the constant in are different depending on the instruction.
For example, Power load/store instructions have two forms,
D form and DS-form.
Currently, we have two separate relocations in
cmd/internal/obj
:R_ADDRPOWER
andR_ADDRPOWER_DS
, which reallyare the same except how to stuff the const into instruction.
We already have a
Reloc.Variant
field to handle a similar concept:slight variants on the same conceptual relocation type, but it's
only used by the linker to implement internal linking (to represent
ELF relocations).
The proposal is to serialize the
Variant
field into object file, sothat the compiler can also use the variant mechanism.
The benefit is that: the variants are defined in arch-specific
packages, and generic code handle the relocations defined
in
cmd/internal/obj
don't need to know about all the archspecific variants of a relocation as the details are irrelevant
unless you are dealing with instruction encoding.
The text was updated successfully, but these errors were encountered: