diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 3cd7b4ad0b4..84e03a40113 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2188,7 +2188,7 @@ func (ctxt *Link) textaddress() { ctxt.Textp[0] = text } - va := uint64(*FlagTextAddr) + va := uint64(Rnd(*FlagTextAddr, int64(Funcalign))) n := 1 sect.Vaddr = va ntramps := 0 @@ -2214,7 +2214,7 @@ func (ctxt *Link) textaddress() { // Set the address of the start/end symbols, if not already // (i.e. not darwin+dynlink or AIX+external, see above). ldr.SetSymValue(etext, int64(va)) - ldr.SetSymValue(text, *FlagTextAddr) + ldr.SetSymValue(text, int64(Segtext.Sections[0].Vaddr)) } // merge tramps into Textp, keeping Textp in address order