cmd/link: making sense of HeadType #22270
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
The linker makes extensive use of HeadType. It does not make much sense to me.
When used as a value, it is very close to meaning
GOOS
. One exception is both "android" and "linux" are represented as "Hlinux", but besides that they are equivalent.When used as a flag to the linker,
-H
, it is the value ofGOOS
, plus the potential value "windowsgui", which is treated as "windows" except it sets a global linker variablewindowsgui
to true. The linker is also receiving theGOOS
environment variable used by the compiler (and all other tools) to make their OS decision.Proposal:
-H
flag alone, as other build systems may depend on it.-H
match.IsELF
global variable withctxt.HeadType == objabi.ELF
instead.windowsgui
withctxt.HeadType == objabi.PEGUI
.Thoughts?
cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: