[dev.link] cmd/link: add internal packages at the end
Currently in the linker we load internal packges first, then the main package, and then load imported packages following the dependency graph. As a result, packages are loaded mostly in the dependency order, except the internal packages. The global symbol indices are assigned the same way. By loading the internal packages at the end, the packages are loaded in the dependency order, so are the global indices. This way, a relocation edge is mostly either within a packge or a forward edge from a smaller index to a larger one. This allows us to use a min-heap work queue in the deadcode pass, to achieve better spatial locality (in the next CL). Change-Id: I01fa9b3cf0c9e9e66006040f6378a51fd78f0f39 Reviewed-on: https://go-review.googlesource.com/c/go/+/204437Reviewed-by: Jeremy Faller <jeremy@golang.org>
Showing
Please register or sign in to comment