mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: flag init functions in object file
Introduce a flag in the object file indicating whether a given function corresponds to a compiler-generated (not user-written) init function, such as "os.init" or "syscall.init". Add code to the compiler to fill in the correct value for the flag, and add support to the loader package in the linker for testing the flag. The new loader API is currently unused, but will be needed in the next CL in this stack. Updates #2559. Updates #36021. Updates #14840. Change-Id: Iea7ad2adda487e4af7a44f062f9817977c53b394 Reviewed-on: https://go-review.googlesource.com/c/go/+/463855 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
8fd6cc8bb5
commit
55bd193575
9 changed files with 30 additions and 0 deletions
|
|
@ -1190,6 +1190,15 @@ func (l *Loader) IsDict(i Sym) bool {
|
|||
return r.Sym(li).IsDict()
|
||||
}
|
||||
|
||||
// Returns whether this symbol is a compiler-generated package init func.
|
||||
func (l *Loader) IsPkgInit(i Sym) bool {
|
||||
if l.IsExternal(i) {
|
||||
return false
|
||||
}
|
||||
r, li := l.toLocal(i)
|
||||
return r.Sym(li).IsPkgInit()
|
||||
}
|
||||
|
||||
// Return whether this is a trampoline of a deferreturn call.
|
||||
func (l *Loader) IsDeferReturnTramp(i Sym) bool {
|
||||
return l.deferReturnTramp[i]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue