mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: apply -B UUID to external linking on Mach-O
Currently, on Mach-O, the -B UUID setting is only applied in internal linking mode, whereas in external linking mode the UUID is always rewritten to a hash of Go build ID. This CL makes it apply to external linking as well. This makes the behavior consistent on both linkmodes, and also consistent with the -B flag's behavior for GNU build ID on ELF. Add tests. Updates #68678. Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-darwin-arm64_13 Change-Id: I276a5930e231141440cdba16e8812df28ac4237b Reviewed-on: https://go-review.googlesource.com/c/go/+/618599 Reviewed-by: Than McIntosh <thanm@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
6a4feb5644
commit
c15e589733
4 changed files with 83 additions and 6 deletions
|
|
@ -1468,6 +1468,9 @@ func (ctxt *Link) hostlink() {
|
|||
argv = append(argv, "-Wl,-x")
|
||||
}
|
||||
}
|
||||
if *flagHostBuildid == "none" {
|
||||
argv = append(argv, "-Wl,-no_uuid")
|
||||
}
|
||||
case objabi.Hopenbsd:
|
||||
argv = append(argv, "-pthread")
|
||||
if ctxt.BuildMode != BuildModePIE {
|
||||
|
|
@ -2059,7 +2062,7 @@ func (ctxt *Link) hostlink() {
|
|||
uuidUpdated = true
|
||||
}
|
||||
}
|
||||
if ctxt.IsDarwin() && !uuidUpdated && *flagBuildid != "" {
|
||||
if ctxt.IsDarwin() && !uuidUpdated && len(buildinfo) > 0 {
|
||||
updateMachoOutFile("rewriting uuid",
|
||||
func(ctxt *Link, exef *os.File, exem *macho.File, outexe string) error {
|
||||
return machoRewriteUuid(ctxt, exef, exem, outexe)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue