- 01 Nov, 2019 3 commits
-
-
Than McIntosh authored
Change the loader to do more bulk allocation when making slices of small objects (sym.Reloc, etc) as part of creating and populating sym.Symbols in loader.LoadFull(). This replaces a large number of small allocations with a smaller number of large allocations, improving performace. Compilebench numbers (linker portion) for this change: name old time/op new time/op delta LinkCompiler 1.71s ±11% 1.57s ± 9% -8.35% (p=0.000 n=19+20) LinkWithoutDebugCompiler 1.19s ±14% 1.10s ±13% -7.93% (p=0.000 n=20+19) name old user-time/op new user-time/op delta LinkCompiler 1.86s ±15% 1.34s ±10% -28.02% (p=0.000 n=20+20) LinkWithoutDebugCompiler 1.05s ±14% 0.95s ± 9% -9.17% (p=0.000 n=19+20) Hyperkube from kubernetes doesn't show any significant benefit (which seems a little surprising). Change-Id: Ide97f78532fb60b08bb6e4cfa097e9058f7ea8ab Reviewed-on: https://go-review.googlesource.com/c/go/+/203457 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by:
Cherry Zhang <cherryyz@google.com> Reviewed-by:
Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Than McIntosh authored
Fix up the new dead code pass to include support for populating the ctxt "Reachparent" map, which is needed to support field tracking. Since we don't have sym.Symbols created at the point where new dead code runs, keep track of reachability using global symbol indices, and then once loader.LoadFull is complete we can translate the index mappings into symbol mappings. The fieldtracking output is unfortunately different relative to master, due to differences in the order in which symbols are encountered in deadcode, but I have eyeballed the results to make sure they look reasonable. Change-Id: I48c7a4597f05c00f15af3bfd37fc15ab4d0017c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/204342 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Cherry Zhang authored
ABI alias references in Go symbols are resolved during loadObjFull. But for external symbols they are not resolved. If there is a reference from an external symbol to a Go ABIInternal symbol, this reference will be invalid as it is not resolved. The old code resolve ABI aliases in the deadcode pass. But the new deadcode pass doesn't do it, as it works with indices instead of Symbols. We do this in LoadFull. This makes all internal cgo linking tests pass on Mach-O. Change-Id: Iac6c084c03f5ddbcc9455527800ce7ed7313f9a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/204698 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
- 31 Oct, 2019 5 commits
-
-
Jeremy Faller authored
Small updates to macho loader, fixing some misunderstandings I had about using the new object file format. Change-Id: I9224b01ca327e3a087ebfa36800bd6eef6abcc80 Reviewed-on: https://go-review.googlesource.com/c/go/+/204097 Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Jeremy Faller authored
Change-Id: Ief8384a74ac9cf303a959656f807f34a0ff9873b Reviewed-on: https://go-review.googlesource.com/c/go/+/204518 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Jeremy Faller authored
Add support for elf host objects with new object file format. Change-Id: Ic5be1953359b9b6b78d9a0b715af69763aefd227 Reviewed-on: https://go-review.googlesource.com/c/go/+/201728 Reviewed-by:
Cherry Zhang <cherryyz@google.com> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Than McIntosh authored
Add a new loader.Loader.ReadAuxSyms method that returns a slice containing the ids of the aux symbols for a specified global symbol. This is similar to the new interface recently added that allows you to get back a slice of relocations (as opposed to making calls into the loader for each one). This was idea suggested by Cherry. Compilebench numbers: name old time/op new time/op delta LinkCompiler 1.63s ± 9% 1.57s ± 7% -3.84% (p=0.006 n=20+20) LinkWithoutDebugCompiler 1.15s ±11% 1.11s ±11% ~ (p=0.108 n=20+20) name old user-time/op new user-time/op delta LinkCompiler 1.99s ± 8% 2.00s ±12% ~ (p=0.751 n=19+19) LinkWithoutDebugCompiler 1.14s ±11% 1.19s ±21% ~ (p=0.183 n=20+20) Change-Id: Iab6cbe18419aaa61d9cadb3f626a4515c71f2686 Reviewed-on: https://go-review.googlesource.com/c/go/+/203501 Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Than McIntosh authored
To speed up the loader.Loader.toLocal() method, cache the index of the most recently accessed object file and check that object's sym range in toLocal() before doing a full binary search over all object symbol ranges. This speeds up relink of kubernetes/hyperkube by about 2%, and improves compilebench (relative to the dev.link branch) by about 5%: name old time/op new time/op delta LinkCompiler 1.62s ± 8% 1.50s ± 9% -7.21% (p=0.000 n=20+19) LinkWithoutDebugCompiler 1.13s ± 8% 1.09s ±12% ~ (p=0.052 n=20+20) name old user-time/op new user-time/op delta LinkCompiler 1.94s ±18% 1.97s ±16% ~ (p=0.813 n=19+20) LinkWithoutDebugCompiler 1.15s ±16% 1.13s ±12% ~ (p=0.547 n=20+20) Change-Id: Id5a8a847b533858373c0462f03972d436eda6748 Reviewed-on: https://go-review.googlesource.com/c/go/+/204337 Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
- 25 Oct, 2019 1 commit
-
-
Than McIntosh authored
Add a cache for the loader.Loader.resolve() method to use when looking mapping local PkgNone symbols to global symbol indices. This helps avoid repeated map lookups during deadcode and other early phases of the linker when we haven't fully read in all of object file symbols. Benchstat numbers: name old time/op new time/op delta LinkCompiler 1.97s ±13% 1.67s ± 8% -15.34% (p=0.000 n=20+20) LinkWithoutDebugCompiler 1.48s ±12% 1.21s ±11% -18.14% (p=0.000 n=20+20) name old user-time/op new user-time/op delta LinkCompiler 2.19s ± 9% 2.04s ±17% -6.98% (p=0.002 n=19+20) LinkWithoutDebugCompiler 1.29s ±13% 1.20s ±13% -7.70% (p=0.000 n=20+20) Change-Id: I4b0b05c8208ee44ee9405b24774b84443e486831 Reviewed-on: https://go-review.googlesource.com/c/go/+/203197 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
- 24 Oct, 2019 3 commits
-
-
Cherry Zhang authored
Compiler-generated function references (e.g. call to runtime.newobject) appear frequently. We assign special indices for them, so they don't need to be referenced by name. Change-Id: I2072594cbc56c9e1037a26e4aae12e68c2436e9f Reviewed-on: https://go-review.googlesource.com/c/go/+/202085 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org>
-
Cherry Zhang authored
As we no longer include static symbols into the name lookup table, it is basically just two maps, one for ABI0, one for ABIInternal. Just use two maps instead. It may be slightly faster to use string-keyed maps than struct-keyed maps (still need performance data to confirm). For now, allow external symbols being referenced by name, as external objects don't use index. Change-Id: I60cedaa7346fce7535970780bc67f93c82160646 Reviewed-on: https://go-review.googlesource.com/c/go/+/201999 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Than McIntosh authored
Incorporate a change suggested by Cherry for CL 201721 that I missed accidentally. Change-Id: I65e6532e78888505573169e56bc4ace9a0f8c510 Reviewed-on: https://go-review.googlesource.com/c/go/+/202760 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
- 21 Oct, 2019 1 commit
-
-
Cherry Zhang authored
Since the previous CL, we will not reference static symbols by name. Therefore no need to put them into the name lookup table. On Linux/ARM, in runtime/internal/atomic/sys_linux_arm.s, the kernelcas function has a definition and a reference written in two different forms, one with package prefix, one without. This way, the assembler cannot know they are the same symbol, only the linker knows. This is quite unusual, unify the names to so the assembler can resolve it to index. Change-Id: Ie7223097be6a3b65f3fa43ed4575da9972ef5b69 Reviewed-on: https://go-review.googlesource.com/c/go/+/201998 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
- 19 Oct, 2019 1 commit
-
-
Cherry Zhang authored
If two symbols have the same name, the old code allows either one being dupok (preferably both, but either is ok). Currently, the new code only works when the new symbol being dupok (or both). Allow only old symbol being dupok as well. One example for this is the tls_g variable on ARM64 and PPC64 when the race detector is enabled. Should fix Linux/ARM64 build. Change-Id: I8dd21c017e826847f13471c30dfd71bf225d8076 Reviewed-on: https://go-review.googlesource.com/c/go/+/201642 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
- 17 Oct, 2019 4 commits
-
-
Than McIntosh authored
Add a new loader.Relocs method that reads all of the relocations for a symbol into a slice. Handy in cases where the client knows in advance that it wants to visit all the relocations on a symbol (as opposed to just one or two). Change-Id: I1a420513e160c8bb4b90c9824ae8d5b5de060c15 Reviewed-on: https://go-review.googlesource.com/c/go/+/201721 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Than McIntosh authored
Change the new loader to keep a note of the set of "go.itablink.*" symbols (using a small map), and add a method that clients can use to query whether a given global index corresponds to a "go.itablink.*" sym. This eliminates one instance of raw symbol name reading/matching during new deadcode, which should produce a minor speedup. Change-Id: I5915773a3f33c16099ccd68592dbba783d909bc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/201400 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Than McIntosh authored
Add a flag bit to mark symbols in the new object file as containing Go type information. The use of a flag eliminates the need to do symbol name matching as part of the new dead code elimination pass, which should produce a minor speedup. Change-Id: Iec8700e1139e2c4e310644c0766379865d2d6f82 Reviewed-on: https://go-review.googlesource.com/c/go/+/201399 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Than McIntosh authored
For the new object file format, don't tag individual symbols with a "shared" flag, since that characteristic is better off as an attribute of the containing object file as opposed to the individual symbol. Add a new flags field in the object file header and put a bit in the flags if the shared flags is in effect during compilation. Change-Id: I2cf6d33bf7bf2fd8a7614ae0cd6ef03914777498 Reviewed-on: https://go-review.googlesource.com/c/go/+/201398 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
- 16 Oct, 2019 2 commits
-
-
Cherry Zhang authored
This CL adds basic shared library support in newobj mode. This is not complete -- there are still tests in misc/cgo/testshared failing. But at least a simple program works, and some tests there pass. Add the mechanism of loading external symbols with contents. (Before, external symbols are always contentless.) This may potentially be also used for other host objects. Change-Id: I68dbf71e7949cc01ebf37ea159084e798ae16925 Reviewed-on: https://go-review.googlesource.com/c/go/+/201537 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org>
-
Than McIntosh authored
Third change of several to update the loader API to reflect the final consensus version of the loader API as described in Cherry's doc. This piece: - move objfile.Loader into its own separate package, and update clients accordingly. This includes a few minor cleanups, including converting a couple of loader-related functions to methods, and privatizing some of the loader methods such as ToGlobal/ToLocal. Change-Id: Iae20585751a45491d8b19dcffc096aadae6bbfc6 Reviewed-on: https://go-review.googlesource.com/c/go/+/200998 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by:
Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 15 Oct, 2019 6 commits
-
-
Cherry Zhang authored
Per Jeremy's comment in CL 199643. This makes the code read better. Change-Id: If270aecd712a27fb52e3faf5a4339200327d9ffe Reviewed-on: https://go-review.googlesource.com/c/go/+/201023 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org>
-
Cherry Zhang authored
When a dupok symbol is resolved to another package, we still need to record its presence in the current package, as the trampoline pass expects packages are laid out in dependency order. At the point after deadcode where we populate symbol contents for reachable symbols (add relocations and read symbol data), make a note of the dupok text symbols for each package. Later in addToTextp we will visit packages in dependency order, process the dup text symbol list for each package and select a final lib for each dup text symbol. Change-Id: Ib885e0a7e2343229d853aa629e3e337111df6011 Reviewed-on: https://go-review.googlesource.com/c/go/+/200797 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
Add InlTree to the FuncInfo aux symbol in new object files. In the linker, change InlinedCall.Func from a Symbol to a string, as we only use its Name. (There was a use of Func.File, but that use is not correct anyway.) So we don't need to create a Symbol if not necessary. Change-Id: I38ce568ae0934cd9cb6d0b30599f1c8d75444fc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/200098 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
If two defined symbols have the same name, one contentless and one with content, the one with content "wins". This is mainly for go:linkname on data symbols. Support this logic in newobj mode. Introduce an "overwrite" mechanism, letting one symbol overwrite another. This machanism could later be used for the linker overwriting symbol contents (e.g. -X flag). Change-Id: I32ee7d4b82df275f11b38c3abefc99b878ff12d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/200097 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
Use the auxiliary symbol mechanism to connect the text symbol and its associated DWARF symbols. This way, the linker can track the DWARF symbols from the text symbol, without looking up special names. Currently, in the linker this is only used in the deadcode pass to track which DWARF symbols are used and need to load. Later passes still use name lookup for now. Change-Id: I2fe49f3b1f0ecc1472ae8aa93907cff740022d8d Reviewed-on: https://go-review.googlesource.com/c/go/+/199801 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
With the new object files, now we can run the deadcode pass on indices instead of Symbol structs, so we can delay creating Symbols after the deadcode pass. Then we only need to create reachable symbols. Not create Symbols in LoadNew and LoadRefs, and recombine LoadReloc into LoadFull. Split loadcgo into two parts: the first finds root symbols, the second create Symbols and sets attributes. The first runs before the deadcode pass, while the second runs after. TODO: currently there are still symbols that are not marked reachable but still used. This includes DWARF symbols, file symbols, and type symbols that are referenced by DWARF symbols. We still need to create them (conservatively). Change-Id: I695779c9312be9d49ab1683957ac3e72e1f65a1e Reviewed-on: https://go-review.googlesource.com/c/go/+/199643 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
- 14 Oct, 2019 4 commits
-
-
Cherry Zhang authored
In CL 196030 we decided to combine the imported package list (Autolib) and referenced package list (PkgIdx, or Pkglist). However, in some cases the Autolib list may contain file name, instead of package path, e.g. https://go.googlesource.com/go/+/refs/heads/dev.link/src/cmd/compile/internal/gc/main.go#1181 And the linker needs that to locate the file. This mostly happens with direct invocation of the compiler and linker (i.e., not through "go build"). Instead of letting the linker make guess of the file name based on the package path, make Autolib a separate list. Change-Id: If195a69462d04db515346ee67cdec925f5a69e2e Reviewed-on: https://go-review.googlesource.com/c/go/+/200157 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Jeremy Faller <jeremy@golang.org>
-
Cherry Zhang authored
When reflect.Type.Method is called, all exported methods from a reachable type need to be conservatively live. When such a function is called, the compiler sets an attribute to the function, and the linker needs to check that attribute. Implement this in the index-based deadcode pass. Unify symbol flags and FuncInfo flags to make things simpler. In particular, the deadcode pass can check the reflectMethod attribute without reading in and decoding FuncInfo. Change-Id: Ibb21e172f2996e899c6efa5551a29d0eca62df67 Reviewed-on: https://go-review.googlesource.com/c/go/+/200099 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
This essentially replicates the logic of live method tracking and type symbol decoding, rewritten to operate on indices instead of Symbols. TODO: the special handling of reflect.Type.Method has not been implemented. TODO: the symbol name is used too much. It ought to be a better way to do it. Change-Id: I860ee7a506c00833902e4870d15aea698a705dd9 Reviewed-on: https://go-review.googlesource.com/c/go/+/199078 Reviewed-by:
Than McIntosh <thanm@google.com>
-
Jeremy Faller authored
Change-Id: I823b19c0742992dd760c6372428a1936bb7c7e70 Reviewed-on: https://go-review.googlesource.com/c/go/+/200768 Reviewed-by:
Jeremy Faller <jeremy@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 11 Oct, 2019 2 commits
-
-
Than McIntosh authored
Update the new deadcode pass to use the revised loader interface for querying relocations. Remove some of the previous loader relocation methods, since they are no longer used. Change-Id: I08cec4c05793a17698b2674068f64837a5bf4477 Reviewed-on: https://go-review.googlesource.com/c/go/+/200718 Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
Than McIntosh authored
Second change of several to update the loader API to reflect the final consensus version of the loader API as described in Cherry's doc. This piece: - define new loader.Relocs() method that returns a struct encapsulating a set of relocations on a global symbol Old way of examining relocations: nreloc := loader.NReloc(someGlobalSymbolIndex) for i := 0; i < nreloc; i++ { tgtIdx := loader.RelocSym(someGlobalSymbolIndex, i)) ... <do something with tgtIdx> } New way of examining relocations: relocs := d.loader.Relocs(someGlobalSymbolIndex) for i := 0; i < relocs.Count; i++ { r := relocs.At(i).Sym ... <do something with r.Sym> } Change-Id: I5bead1d729655ea13b3396647e53aafcd3e60f97 Reviewed-on: https://go-review.googlesource.com/c/go/+/200717 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Cherry Zhang <cherryyz@google.com>
-
- 10 Oct, 2019 3 commits
-
-
Cherry Zhang authored
The package references recorded in the object file, which are obtained from the compiler, are escaped. We should also use the escaped package paths in the linker for resolving package references. Change-Id: I42eb12df6ff24330e6dc7bed1dc8224bb3b8a106 Reviewed-on: https://go-review.googlesource.com/c/go/+/200158 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
Switch the deadcode pass to use indices instead of Symbol structures when using new object file format. Delay loading symbol relocations and contents fully after the deadcode pass. The next step is not to create Symbol structures until deadcode is done. Method tracking logic hasn't been implemented. Currently, all methods of a reachable type are live. Change-Id: Iffcd06ff84e6e52bd9eb24d1220d94234d18ab6b Reviewed-on: https://go-review.googlesource.com/c/go/+/198199 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Than McIntosh authored
First change of several to update the loader API to reflect the final consensus version of the loader API as described in Cherry's doc. This piece: - define new loader.Sym type to encapsulate a global symbol index (as opposed to just using 'int') Change-Id: I6f6483e269f80abfc7d373b2856b2c0d61b9ac24 Reviewed-on: https://go-review.googlesource.com/c/go/+/200417 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Austin Clements <austin@google.com> Reviewed-by:
Jeremy Faller <jeremy@golang.org>
-
- 09 Oct, 2019 3 commits
-
-
Cherry Zhang authored
[dev.link] cmd/link, cmd/internal/goobj2: adopt new DWARF compilation unit logic with new object file The dev.link branch was not sync'd with the new DWARF compilation unit logic change on the master branch, and the new object file format didn't support this. This CL adds the new DWARF CU and file table support to the new object file format. In the old object file, the DWARF file table is a separate section. For now, we do the same with the new object file, keeping it as a separate block. While here, also refactor the loader code so it is easier for the loader to carry per-object informations. Change-Id: I4c317941fc0a5831acbc11ce8c2a8b7421471372 Reviewed-on: https://go-review.googlesource.com/c/go/+/198198 Reviewed-by:
Austin Clements <austin@google.com>
-
Cherry Zhang authored
With the old object file format, we use mmap (if supported) to read object files and back symbol data with mapped read-only memory. Do the same with the new object file format. This also significantly reduces number of syscalls made to read object files. Currently we still do mmap in object file level, not archive level. This is probably ok, as there shouldn't be many archives that contain more than one object. If this is a problem we can change that later. Change-Id: Icae3ef14d8ed6adbee1b5b48d420e2af22fd9604 Reviewed-on: https://go-review.googlesource.com/c/go/+/197797 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
Cherry Zhang authored
If the new object file format is used, now we load full symbol contents after the deadcode pass, for reachable symbols only. We still load some informations early, like relocations and the contents of type symbols, which are used in the deadcode pass. If we rewrite deadcode to use index directly, we could delay more of the loading (to sym.Symbol), and perhaps delay the creation of sym.Symbol. TODO: internal linking with host objects doesn't work yet. Change-Id: I7d4880e8f150e8709ffac277e62191623440e4cf Reviewed-on: https://go-review.googlesource.com/c/go/+/197258 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
- 08 Oct, 2019 1 commit
-
-
Cherry Zhang authored
Follow-up of Than's comment on CL 196032. For runtime.gcbits symbols, the compiler already sets the "local" attribute (cmd/compile/internal/gc/reflect.go:dgcptrmask). No need of the special handling in the linker. Change-Id: I7c53a818ed0375083f04655f3565c1c9c45f2401 Reviewed-on: https://go-review.googlesource.com/c/go/+/199642 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-
- 04 Oct, 2019 1 commit
-
-
Cherry Zhang authored
Parse new object file format in the linker. At least we can link a hello-world program. Add a basic "loader", which handles symbol references in the object file. - mapping between local and global indices - resolve by-name references (TODO: the overwrite logic isn't implemented yet) Currently we still create sym.Symbol rather early, and, after all the object files are loaded and indexed references are resolved, add all symbols to sym.Symbols. The code here is probably not going in the final version. This is basically only for debugging purposes -- to make sure the writer and the reader work as expected. Change-Id: I895aeea68326fabdb7e5aa1371b8cac7211a09dd Reviewed-on: https://go-review.googlesource.com/c/go/+/196032 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Than McIntosh <thanm@google.com>
-