mirror of
https://github.com/golang/go.git
synced 2025-05-23 16:31:27 +00:00
cmd/go: look for __go_buildinfo section when looking for Mach-O version
This mirrors the ELF fix in CL 188957. TestScript/version failed on darwin after that change. Fixes #31861 Change-Id: I4ce953ebec8dd5fa47e26d373c59d7e290b75a34 Reviewed-on: https://go-review.googlesource.com/c/go/+/189159 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
8e82624e69
commit
46f99ce7ea
@ -213,7 +213,13 @@ func (x *machoExe) ReadData(addr, size uint64) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (x *machoExe) DataStart() uint64 {
|
||||
// Assume data is first non-empty writable segment.
|
||||
// Look for section named "__go_buildinfo".
|
||||
for _, sec := range x.f.Sections {
|
||||
if sec.Name == "__go_buildinfo" {
|
||||
return sec.Addr
|
||||
}
|
||||
}
|
||||
// Try the first non-empty writable segment.
|
||||
const RW = 3
|
||||
for _, load := range x.f.Loads {
|
||||
seg, ok := load.(*macho.Segment)
|
||||
|
Loading…
x
Reference in New Issue
Block a user