]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: add defined package symbols first, before any non-package symbols
authorCherry Zhang <cherryyz@google.com>
Tue, 11 Feb 2020 15:27:15 +0000 (10:27 -0500)
committerCherry Zhang <cherryyz@google.com>
Wed, 12 Feb 2020 22:07:52 +0000 (22:07 +0000)
commitb0275bfbf4992e3e63f279b3fc7ba1f93700abff
tree0897da6d1fe441b329f10a3cafc456a36e2751f5
parentab1253b59ae7bfe5a064bf299bc896a65cc5a027
[dev.link] cmd/link: add defined package symbols first, before any non-package symbols

Currently, the loader adds defined package symbols and
non-package symbols to the global index space object by object.
This CL changes it to add all the defined package symbols first,
then all the non-package symbols. The advantage of doing this is
that when adding package symbols, by definition they cannot be
dup to each other, so we don't need to do a name lookup when
adding them.

We still add them to the lookup table (for now), since they may
still be referenced by name (e.g. through linkname). This CL is
also a prerequisite if we want to move to not adding package
symbols to the lookup table entirely (e.g. by using
pre-generated in-file lookup table).

Also update some comments to reflect the current state.

Change-Id: Ib757e070b48a9ef6215e47dc3421fc5c055b746c
Reviewed-on: https://go-review.googlesource.com/c/go/+/219078
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loader/loader_test.go