mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: separate virtual address layout from file layout
Currently these two forms of layout are done in a single pass. This makes it difficult to compress DWARF sections because that must be done after relocations are applied, which must happen after virtual address layout, but we can't layout the file until we've compressed the DWARF sections. Fix this by separating the two layout steps. In the process, we can also unify the copy-pasted code in Link.address to compute file offsets, which currently has some unnecessary variation. Unlike the current file offset computation, which depends on virtual addresses, the new computation only uses file offsets and sizes. This will let us compress the file representation of a segment and create the file layout based on its on-disk size rather than its original in-memory size. Tested by comparing the test binary for the "strings" package on all supported GOOS/GOARCH combinations. All binaries are identical (except, of course, their build IDs). This is a second attempt at CL 111682. For #11799. Fixes #25863. Change-Id: If09f28771bb4d78dd392fd58b8d7c9d5f22b0b9e Reviewed-on: https://go-review.googlesource.com/118716 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
c12399fffb
commit
8998c55ec0
2 changed files with 49 additions and 29 deletions
|
|
@ -224,8 +224,9 @@ func Main(arch *sys.Arch, theArch Arch) {
|
|||
ctxt.typelink()
|
||||
ctxt.symtab()
|
||||
ctxt.dodata()
|
||||
ctxt.address()
|
||||
order := ctxt.address()
|
||||
ctxt.reloc()
|
||||
ctxt.layout(order)
|
||||
thearch.Asmb(ctxt)
|
||||
ctxt.undef()
|
||||
ctxt.hostlink()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue