mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj/x86: make SEH symbols content-addressable
Currently, the SEH symbol is defined as an aux symbol of the function symbol, without adding to ctxt.Data. Each function has its own SEH symbol. As there are a lot of duplications of the SEH symbol contents, currently a Go object file may contain many copies of identical SEH symbols. They are deduplicated at link time. But it does make the linker do redundant work, and make it hard to reason about the SEH symbol writing in the object file writer, and its resolution in the linker. In fact, in the object file writer, the same SEH symbol may be added to the ctxt.defs multiple times (as it is the aux of multiple function symbols), which is not expected. In fact, "aux symbol" is just a mechanism to associate auxiliary data to another symbol. The auxiliary data symbol itself can be an ordinary data symbol, even a content-addressable symbol. Define the SEH symbol as a conntent-addressable symbol and add it to ctxt.Data. This way there is only one definition of each unique SEH symbol, which can be the aux of many functions. While here, add a check to ensure that we add a symbol at most once to the defs list. Change-Id: Ie7a0cf02ca114060423e025931b30de97ca330fe Reviewed-on: https://go-review.googlesource.com/c/go/+/585656 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
8056540772
commit
27603028eb
4 changed files with 18 additions and 4 deletions
|
|
@ -1058,6 +1058,10 @@ type Link struct {
|
|||
// to Data.
|
||||
constSyms []*LSym
|
||||
|
||||
// Windows SEH symbols are also data symbols that can be created
|
||||
// concurrently.
|
||||
SEHSyms []*LSym
|
||||
|
||||
// pkgIdx maps package path to index. The index is used for
|
||||
// symbol reference in the object file.
|
||||
pkgIdx map[string]int32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue