mirror of
https://github.com/golang/go.git
synced 2025-05-28 19:02:22 +00:00
cmd/link: resolve __CTOR_LIST__/__DTOR_LIST__ refs for PE
When doing an internal link on Windows, it's possible to see unresolved references to the symbols "__CTOR_LIST__" and/or "__DTOR_LIST__" (which are needed in some circumstances). If these are still unresolved at the point where we're done reading host objects, then synthesize dummy versions of them. Updates #35006. Change-Id: I408bf18499bba05752710cf5a41621123bd84a3b Reviewed-on: https://go-review.googlesource.com/c/go/+/383836 Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
2ea9376266
commit
cdee8004ab
@ -665,6 +665,21 @@ func loadWindowsHostArchives(ctxt *Link) {
|
||||
any = true
|
||||
}
|
||||
}
|
||||
// If needed, create the __CTOR_LIST__ and __DTOR_LIST__
|
||||
// symbols (referenced by some of the mingw support library
|
||||
// routines). Creation of these symbols is normally done by the
|
||||
// linker if not already present.
|
||||
want := []string{"__CTOR_LIST__", "__DTOR_LIST__"}
|
||||
isunresolved := symbolsAreUnresolved(ctxt, want)
|
||||
for k, w := range want {
|
||||
if isunresolved[k] {
|
||||
sb := ctxt.loader.CreateSymForUpdate(w, 0)
|
||||
sb.SetType(sym.SDATA)
|
||||
sb.AddUint64(ctxt.Arch, 0)
|
||||
sb.SetReachable(true)
|
||||
ctxt.loader.SetAttrSpecial(sb.Sym(), true)
|
||||
}
|
||||
}
|
||||
// TODO: maybe do something similar to peimporteddlls to collect
|
||||
// all lib names and try link them all to final exe just like
|
||||
// libmingwex.a and libmingw32.a:
|
||||
|
Loading…
x
Reference in New Issue
Block a user