aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loader
AgeCommit message (Collapse)Author
2020-04-08[dev.link] cmd/link: return package path in SymFileCherry Zhang
SymFile, derived from sym.Symbol.File, is supposed to return the package path, instead of the file name (arguably the name is confusing). Make it so, and rename it to SymPkg. Change-Id: I67bcd12f67cea271f2a2ce3c5724e5d228f5b2f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/227481 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>
2020-04-07[dev.link] cmd/link/internal/loader: speed up Loader.RelocVariantThan McIntosh
Remove some extra sanity-checking code from the loader's RelocVariant method, since it was yielding a slowdown of 1-2% linking kubernetes hyperkube (once again a reminder that relocation processing is a very performance-sensitive part of the linker). Change-Id: Ifbc0662f3f96c5f54131103ce6f7439ecfb9b9dc Reviewed-on: https://go-review.googlesource.com/c/go/+/227477 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-06[dev.link] cmd/link/internal/loader: support 'variant' relocationsThan McIntosh
Add support to the loader for getting/setting the 'variant' property of a symbol relocation. The variant property handles unusual or infrequently used relocations that have both a type and a variant of that type (this is needed for S390). In the sym.Symbol world, a relocation variant is a field on the 'relocExt' extension that is part of sym.Reloc. In this new implementation for the loader, reloc variants are stored in a side table (a map) in the loader, and accessed via loader methods. Change-Id: I62bf54ae7ff6d500c0ea8d2dbe759b2431087378 Reviewed-on: https://go-review.googlesource.com/c/go/+/227018 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-02[dev.link] cmd: support large function alignmentCherry Zhang
This ports CL 226997 to the dev.link branch. - The assembler part and old object file writing are unchanged. - Changes to cmd/link are applied to cmd/oldlink. - Add alignment field to new object files for the new linker. Change-Id: Id00f323ae5bdd86b2709a702ee28bcaa9ba962f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/227025 Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-01[dev.link] cmd/internal/goobj2, cmd/link: add and use new Sym accessorsCherry Zhang
Along the line with Reloc and Aux, use new-style accessors for the Sym type. They avoid reading unnecessary fields, and also look nicer (to me). Change-Id: Ie37c5149a6edb2184724b3dfa26952015e74c085 Reviewed-on: https://go-review.googlesource.com/c/go/+/226798 Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-31[dev.link] cmd/link: unify Relocs.Count and len(rs)Cherry Zhang
The Count field in Relocs type is always equal to len(rs). Unify them. Change-Id: Ic77288ea58b61a98482b218e051d81047d0ddd88 Reviewed-on: https://go-review.googlesource.com/c/go/+/226717 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-31[dev.link] cmd/link: store external relocations in Reloc2 formatCherry Zhang
Store external relocations in (almost) the same format as the Go objects, so we can handle them more uniformly. There is a small speedup: (linking cmd/compile) Deadcode 67.8ms ± 3% 61.1ms ± 3% -9.94% (p=0.008 n=5+5) Dostkcheck 41.2ms ± 2% 38.8ms ± 3% -5.99% (p=0.008 n=5+5) Change-Id: I8616e10b26235904201d6c9465f5ae32a49c9949 Reviewed-on: https://go-review.googlesource.com/c/go/+/226365 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-30[dev.link] cmd/link/internal/loader: copy Dynid when migrating sym attrsThan McIntosh
Add support for migrating over the symbol Dynid property when converting loader.Sym symbols to sym.Symbol. Change-Id: Icc3b91b4adcae6f2ede7d915bb674cc206025217 Reviewed-on: https://go-review.googlesource.com/c/go/+/226360 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-30[dev.link] cmd/link: use new-style Aux accessors in the loaderCherry Zhang
And remove the old-style one. Change-Id: Ia6c84448108dd1da68451df2221c7c1005c45a0d Reviewed-on: https://go-review.googlesource.com/c/go/+/226364 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>
2020-03-30[dev.link] cmd/link: use new-style relocation accessors in LoadFullCherry Zhang
This gives some small speedup: (linking cmd/compile) Loadlibfull 77.8ms ± 6% 68.6ms ± 5% -11.88% (p=0.008 n=5+5) Also convert some Relocs.At to At2, which should have been done earlier. Change-Id: I2a66aeb5857234c6e645e1b23380149cffc8221f Reviewed-on: https://go-review.googlesource.com/c/go/+/226363 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-30[dev.link] cmd/link, cmd/oldlink: detect object file format mismatchCherry Zhang
When using the new(old) linker but an old(new) object file is found, give a better error message. Change-Id: I94786f1a4b527c15c4f5b00457eab60d215a72a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/225457 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-28[dev.link] cmd/link/internal/loader: add Loader plt/got access methodsThan McIntosh
Add accessor methods to get at the symbol {plt,got} value for PE symbols. Fix a bug in the loaders SetPlt/SetGot methods. Change-Id: I975bd6b86122622b206487c8798f8290ecd25a57 Reviewed-on: https://go-review.googlesource.com/c/go/+/225199 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-27[dev.link] cmd/link: migrate symbol's Value and Align when converting to ↵Cherry Zhang
sym.Symbols Currently, in LoadFull we migrate a symbol's Value to sym.Symbol only for external symbols. And symbol's Align is not migrated at all. As we move LoadFull forward, there are already places where we set symbol's Value and Align (e.g. in doelf). Migrate them correctly. Currently I think we only set them on external symbols, but as we move forward I think we'll need to set them on Go symbols as well. Change-Id: I63e97e38fc08b653ba9faefe15697944faf21bed Reviewed-on: https://go-review.googlesource.com/c/go/+/225658 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-25[dev.link] cmd/link: convert doxcoff to new styleCherry Zhang
Change-Id: Ic1e4ed6c14e049b1ba2f7c00f986433ab7ebe932 Reviewed-on: https://go-review.googlesource.com/c/go/+/225202 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-25[dev.link] cmd/link: move setupdynexp before loadlibfullThan McIntosh
Rewrite setupdynexp to work with loader.Sym, and move the call to it before the body of loadlibfull. After loadlibfull is complete, construct the old *sym.Symbol version of dynexp, since not all all clients that access this list are converted to the loader APIs. Change-Id: I347d24958e2f3e2332fbe33f2eb6ec25cc126bdb Reviewed-on: https://go-review.googlesource.com/c/go/+/224382 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-25[dev.link] cmd/link: minor tweaks to PropagateLoaderChangesToSymbolsThan McIntosh
Update PropagateLoaderChangesToSymbols so that it no longer requires a sym.Symbols pointer. The intent is to generalize it a little to allow it to be used in more than just linker Dwarf generation. Change-Id: I9bddc5d39839eacd9113c945bb59d2873c0b088c Reviewed-on: https://go-review.googlesource.com/c/go/+/224381 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-24[dev.link] cmd/link: use Extname in doxcoffCherry Zhang
On AIX, when external linking, we need to change the function names to start with a dot and make function descriptors with the names without the dot. Currently this is done through symbol renaming, which is not friendly for switching to the loader. In this CL we use symbol's external name for this. This allows us to get rid of symbol renaming. Change-Id: If72602d17e96f0339fdac2e2321f1edfb292b5f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/224940 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-24[dev.link] cmd/link: convert mangleTypeSym to new styleCherry Zhang
Use symbol's Extname, instead of symbol renaming, for the mangled names. The old symbol Rename has an interesting logic of "merging" symbols, when a symbol is renamed to the name of an existing symbol. It turns out that this is needed for linking against shared libraries, where the Go object has a reference to a symbol with the original name, and the shared libary provides a symbol under the mangled name. Implement this logic with the loader. Change-Id: Ib95d7a9c93a52f8e02f4a51ac67240d6ebfc1c6a Reviewed-on: https://go-review.googlesource.com/c/go/+/224939 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-23[dev.link] cmd/link: set "local" attribute on symbols during preloadThan McIntosh
Set the "local" attribute on object file loader symbols during preload, as opposed to the current strategy of only propagating the local attr when we convert to sym.Symbols. Change-Id: I18965e2fdaa9a0b9315d95466d17d9f41aa40a45 Reviewed-on: https://go-review.googlesource.com/c/go/+/224379 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>
2020-03-23[dev.link] cmd/link: add loader.Loader apis for symbol dynamic idThan McIntosh
Add SymDynid and SetSymDynid methods to the loader. This symbol property is currently backed by a map. Change-Id: Iaf86b1d8aaa775fa102fadea30394eb8a670e0e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/224378 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>
2020-03-20[dev.link] cmd/link: minor perf tweak for PropagateLoaderChangesToSymbolsThan McIntosh
When fixing up relocations in PropagateLoaderChangesToSymbols, don't reallocate the target sym.Symbol relocation slice if it already has the desired size (this gets rid of some unneeded allocations). Change-Id: I05287772c18cab861c2df805fa9497103fb00dcc Reviewed-on: https://go-review.googlesource.com/c/go/+/224420 Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-20[dev.link] cmd/compile, cmd/link: move away from DWARF file renumberingThan McIntosh
This patch moves the compiler and linker away from the current scheme used to generate file references in DWARF subprogram dies. Up until now the scheme has been to have the compiler emit a special relocation on a DIE file reference that points to the file symbol in question. The linker then reads this relocation and updates the addend to the index of the appropriate file in the line table of the compilation unit of the DIE (the linker emits the comp unit file table, so it knows at that point what number use). The drawback of this scheme is that it requires a lot of relocation processing. With this patch, we switch to having the compiler emit the file index directly, and then have the linker use the compiler-generated file table to emit the line table file section (no renumbering, no relocations, etc). Change-Id: Id4fbe67b28a64200a083e3c5ea358dbe091ec917 Reviewed-on: https://go-review.googlesource.com/c/go/+/223318 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-20[dev.link] cmd/compile, cmd/link: move DWARF info sym to anonymous aux dataThan McIntosh
Switch the primary subprogram die DWARF symbol emitted by the compiler from named+dupOK to anonymous aux. This should help performance wise by not having to add these symbols to the linker's symbol name lookup tables. Change-Id: Idf66662b8bf60b3dee9a55e6cd5137b24a9f5ab6 Reviewed-on: https://go-review.googlesource.com/c/go/+/223669 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-18[dev.link] cmd/link: cleanup of attribute handling codeThan McIntosh
Minor cleanup of symbol attributes. Specifically: - if a symbol originally begins life as an object file symbol, then is converted to external in cloneToExternal, use the previously recorded object file index for the sym to figure out if it has read-only data (in the case that there is no entry for it in the map in question). - remove SetAttrShared; only the loader should be populating this attribute at symbol creation (it never gets updated later) - remove unused copyAttributes() method - comment fixes Change-Id: Iac7bc6ac310ec89bfe733ddc783970d2a8017478 Reviewed-on: https://go-review.googlesource.com/c/go/+/223667 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-18[dev.link] cmd/link: remove AddExtSymCherry Zhang
They used to be different at some point, but now AddExtSym and LookupOrCreateSym are identical. Remove one. Change-Id: I299444d987e32a7f43915b3c1bbcc5ae906e9b6a Reviewed-on: https://go-review.googlesource.com/c/go/+/223977 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-16[dev.link] cmd/internal/goobj2, cmd/link: experiment new aux symbol accessorsCherry Zhang
Following the previous CLs, do the same for aux symbols. This has some small speedup: (linking cmd/compile) Dostkcheck 41.0ms ± 1% 38.6ms ± 1% -6.00% (p=0.008 n=5+5) Change-Id: Id62b2fc9e4ef1be92e60e4c03faec0a953eee94e Reviewed-on: https://go-review.googlesource.com/c/go/+/222303 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-16[dev.link] cmd/internal/goobj2, cmd/link: avoid some repeated offset ↵Cherry Zhang
calculations When iterating relocations, do the offset calculation just once. This gives some speedup: (linking cmd/compile) Deadcode 52.8ms ± 1% 47.6ms ± 1% -10.01% (p=0.008 n=5+5) Dostkcheck 44.2ms ± 1% 41.0ms ± 1% -7.29% (p=0.008 n=5+5) Change-Id: I09e38bc29afc379a81f99e3ee4ff467bc1b5f8a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/222302 Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-13[dev.link] cmd/link: don't truncate external relocation typeCherry Zhang
In CL 222244, we store external relocations in the same format as Go object files. In Go object file format, the relocation type is a uint8. However, for external relocations the type may not always fit in a uint8. Truncating it will result in a bad relocation. Fix this by storing the external reloc type on the side. (An alternative is to extend the Go object file format to use a uint16, but it is not necessary for Go relocations and will waste some binary size.) Fix ARM build. Change-Id: I343e240d38ee0e2cc91e0e7754d03b19b525a014 Reviewed-on: https://go-review.googlesource.com/c/go/+/223338 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-13[dev.link] cmd/link: convert dope to new styleCherry Zhang
Also convert a manually managed array to slice. Change-Id: I7d0dd3d5f569ab237893f589b6022f0f351bca16 Reviewed-on: https://go-review.googlesource.com/c/go/+/223337 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>
2020-03-13[dev.link] cmd/link: experiment new reloc accessors in deadcode passCherry Zhang
There is a small speedup: (linking cmd/compile) name old time/op new time/op delta Deadcode 57.1ms ± 1% 53.5ms ± 1% -6.44% (p=0.008 n=5+5) With this, we don't need a slice to read the relocations, reduce some allocations. name old alloc/op new alloc/op delta Deadcode 4.16MB ± 0% 3.84MB ± 0% -7.85% (p=0.008 n=5+5) Change-Id: Icd41c05682ba3f293a8cb9d2fe818e39d7276e5a Reviewed-on: https://go-review.googlesource.com/c/go/+/222244 Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-13[dev.link] cmd/internal/goobj2, cmd/link: experiment another way of ↵Cherry Zhang
accessing relocations Use a different mechanism to access relocations from the object files, and use it in the stack bounds check pass. This shows some speedup. (linking cmd/compile) Dostkcheck 76.9ms ± 1% 55.1ms ± 1% -28.36% (p=0.008 n=5+5) Change-Id: I2ac42da515dccd64719fb557ffff6cdc69e4319b Reviewed-on: https://go-review.googlesource.com/c/go/+/222240 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-12[dev.link] cmd/link: demote dwarf {range,loc} sub-symbols to auxThan McIntosh
When the compiler emits DWARF for a function F, in addition to the text symbol for F, it emits a set of sibling or child symbols that carry the various DWARF bits for F (for example, go.info.F, go.ranges.F, go.loc.F, and so on). Prior to the linker modernization work, name lookup was the way you made your way from a function symbol to one of its child DWARF symbols. We now have a new mechanism (aux symbols), so there is really no need for the DWARF sub-symbols to be named or to be dupok. This patch converts DWARF "range" and "loc" sub-symbols to be pure aux syms: unnamed, and connected to their parent text symbol only via aux data. This should presumably have performance benefits in that we add fewer symbols to the linker lookup tables. Other related DWARF sub-symbols (ex: go.line.*) will be handled in a subsequent patch. Change-Id: Iae3ec2d42452962d4afc1df4a1bd89ccdeadc6e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/222673 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-11[dev.link] cmd/link: convert doelf to new styleCherry Zhang
Change-Id: I448fe632ae73ddcb79c05793c96f48e358060305 Reviewed-on: https://go-review.googlesource.com/c/go/+/222977 Reviewed-by: Than McIntosh <thanm@google.com>
2020-03-10[dev.link] cmd/link: remove patchDWARFName from the linkerThan McIntosh
Remove the various bits of code in the linker that patch DWARF name attributes (rewrite "". to packagepath). Change-Id: I29a38d680d411ccf1c1eeb760f2d15fc8ec22d90 Reviewed-on: https://go-review.googlesource.com/c/go/+/222719 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-06[dev.link] cmd/link: convert domacho to new styleCherry Zhang
Change-Id: I6e009d01e490534fe1d7d0acd39746158bfcfa24 Reviewed-on: https://go-review.googlesource.com/c/go/+/222301 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-06[dev.link] cmd/link: remove debugging codeThan McIntosh
Remove a few lines of debugging trace output code left in by accident when the final version of CL 220987 was submitted. Change-Id: Ib84a4658194266597140a0e88a2f90f57f78cf53 Reviewed-on: https://go-review.googlesource.com/c/go/+/222299 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-05[dev.link] cmd/link: convert second phase of DWARF-gen to use loaderThan McIntosh
This converts the second portion of DWARF-gen (dwarfGenerateDebugSyms function and friends) to use the loader, as opposed to sym.Symbols. Second phase is invoked as part of dodata(), which is fairly far along in the linker, meaning that the "converted to loader.Symbol" wavefront has not yet reached that point. To account for this, the patch contains some shim code that runs initially to copy back things from sym.Symbols into the loader (notable symbol values), and then a second hook to be code after dwarf-gen is complete to that copies the results back into the appropriate sym.Symbols. This code is obviously temporary, but needed for the time being. Change-Id: I9b830b08b16480a1a5230cb52b592db1c550af18 Reviewed-on: https://go-review.googlesource.com/c/go/+/220987 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-05[dev.link] cmd/link: small cleanup of loader ocacheThan McIntosh
Remove references to the loader.Loader's "ocache" field, which is no longer being used the way it was. Add in a new field for object index to the oReader type. Change-Id: Icae6c54dbbdbbfa63ab9de3e4dc09e10abd57ee3 Reviewed-on: https://go-review.googlesource.com/c/go/+/222063 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-05[dev.link] cmd/link: expose loader PatchDWARFName hook for asm subprogram DIEsThan McIntosh
Add a new loader method PatchDWARFName to patch up live DWARF function DIEs during DWARF generation. This is needed to handle subprogram DIE symbols emitted by the assembler, which still embeds "". package tokens into the data sections of these dies. Note: this is expected to be a temporary hack, as we are going to transition the assembler to do the patching itself when passed the "-p" option (once this happens the plan is to toss all of the various PatchDWARFName helpers). Change-Id: Id689a751f08d7f4c096c4ac2f99991f9641959e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/220986 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-05[dev.link] cmd/link: fix up ctxt.Textp2 handling in AssignTextSymbolOrderThan McIntosh
Change the loader method AssignTextSymbolOrder to return a slice of all reachable textp symbols, since it will be needed in second-phase DWARF gen. Change-Id: Iaf16ee9cf0d5266aeb0d3df596e8117263b35d8e Reviewed-on: https://go-review.googlesource.com/c/go/+/220985 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-03-04[dev.link] cmd/link: don't always load type symbolsCherry Zhang
The type symbols were always loaded in LoadFull, as the old sym.Symbol-based DWARF generation needs them to present. Now we have converted the DWARF type generation pass, which uses the loader symbols directly. No need to load the type symbols if they are not live. This reduces loaded symbols by ~18% for cmd/compile. Change-Id: Ic1f6fcdff845f3c62784d05ad716b1742f249481 Reviewed-on: https://go-review.googlesource.com/c/go/+/222018 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-03[dev.link] cmd/link: remove sym.Symbols lookup mapCherry Zhang
Let the loader provide lookup functionalities. Change-Id: I7d90166d12e6e6fd30e75cbda5d3097e93f9af1e Reviewed-on: https://go-review.googlesource.com/c/go/+/221137 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>
2020-02-28[dev.link] cmd/link: fix up 'top frame' attribute in preloadThan McIntosh
Populate the 'top frame' attribute for function symbols during preload (needed for DWARF debug frame generation). Change-Id: If27836f51ebafa3c1c29b268a22d72d1b59b505a Reviewed-on: https://go-review.googlesource.com/c/go/+/220983 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-26[dev.link] cmd/link: export loader's symbol bitmapCherry Zhang
Export loader's bitmap. As more things converted to new style, I think it may be not uncommon to have bitmaps for symbols used outside of the loader. Change-Id: Ida68dac87988957a29985143121d781296820fcf Reviewed-on: https://go-review.googlesource.com/c/go/+/220980 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-02-25[dev.link] cmd/internal/goobj2, cmd/link: add accessors for field of FuncInfoCherry Zhang
Add accessors for fields of FuncInfo, so we don't have to read the whole FuncInfo. TODO: explore/experiment with an alternative idea -- splitting FuncInfo to separate Aux symbols. Change-Id: Ie4bc2613fd76d08fc63fd86956802920da63dd2f Reviewed-on: https://go-review.googlesource.com/c/go/+/220979 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2020-02-19[dev.link] cmd/internal/goobj2: move NoSplit to symbol flagCherry Zhang
Move NoSplit flag from FuncInfo to symbol flag, so this can be accessed easily without reading the FuncInfo. The CFunc flag is never used. Remove. Change-Id: I8bf4fcb2f209434bb90ccc4987a4c3f28f003323 Reviewed-on: https://go-review.googlesource.com/c/go/+/220058 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>
2020-02-19[dev.link] cmd/link: convert DWARF type generation to use loaderThan McIntosh
Converts the portion of DWARF generation that deals with creation of type DIEs and constant DIEs to use the new loader interfaces. Creation of subprogram DIE and compilation unit DIE content still operates on sym.Symbols at the moment, and happens much later in the linker. The new code for type DIE generation is gated/guarded by the linker flag "-newdw", which currently defaults to true. At some point in the near future this flag should be removed, but it is handy for triage at the moment. This patch also includes shim code designed to run after loadlibfull() that walks through the DIE chains and to converts loader.Sym references back into sym.Symbol references for the remainder of the compilation, since the second phase of DWARF has not yet been converted. Change-Id: I681a00fb8a1f3c37884a79b373d86411332e07c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/208230 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-02-18[dev.link] cmd/link: dostrdata and fieldtrack with new symsJeremy Faller
Move the wavefront past fieldtrack and dostrdata. Change-Id: Ia327ece0202e24031fec7e1f70b40e15fbb4f728 Reviewed-on: https://go-review.googlesource.com/c/go/+/219226 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-13[dev.link] cmd/link: remove the second result of MakeSymbolUpdaterCherry Zhang
With unique global indices, MakeSymbolUpdater will not change the symbol's index. So no need to return a new index. Change-Id: I5b4fd6a0167cc74476880bbf4382c524ecde7721 Reviewed-on: https://go-review.googlesource.com/c/go/+/219227 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>
2020-02-13[dev.link] cmd/link: clean up unused function and argumentsCherry Zhang
Change-Id: Idacb027c5ae11e029ee4ab10f6c9a76ff435e5b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/219228 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>