diff --git a/src/cmd/link/internal/ld/macho_combine_dwarf.go b/src/cmd/link/internal/ld/macho_combine_dwarf.go index 3c123a092f..72ee8affab 100644 --- a/src/cmd/link/internal/ld/macho_combine_dwarf.go +++ b/src/cmd/link/internal/ld/macho_combine_dwarf.go @@ -245,7 +245,7 @@ func machoCombineDwarf(ctxt *Link, exef *os.File, exem *macho.File, dsym, outexe } } // Do the final update of the DWARF segment's load command. - return machoUpdateDwarfHeader(&reader, ctxt.BuildMode, compressedSects) + return machoUpdateDwarfHeader(&reader, compressedSects, dwarfsize) } // machoCompressSections tries to compress the DWARF segments in dwarfm, @@ -390,7 +390,7 @@ func machoUpdateSections(r loadCmdReader, seg, sect reflect.Value, deltaOffset, } // machoUpdateDwarfHeader updates the DWARF segment load command. -func machoUpdateDwarfHeader(r *loadCmdReader, buildmode BuildMode, compressedSects []*macho.Section) error { +func machoUpdateDwarfHeader(r *loadCmdReader, compressedSects []*macho.Section, dwarfsize uint64) error { var seg, sect interface{} cmd, err := r.Next() if err != nil { @@ -408,8 +408,6 @@ func machoUpdateDwarfHeader(r *loadCmdReader, buildmode BuildMode, compressedSec } segv := reflect.ValueOf(seg).Elem() segv.FieldByName("Offset").SetUint(uint64(dwarfstart)) - segv.FieldByName("Addr").SetUint(uint64(dwarfaddr)) - segv.FieldByName("Prot").SetUint(0) if compressedSects != nil { var segSize uint64 @@ -417,23 +415,27 @@ func machoUpdateDwarfHeader(r *loadCmdReader, buildmode BuildMode, compressedSec segSize += newSect.Size } segv.FieldByName("Filesz").SetUint(segSize) - segv.FieldByName("Memsz").SetUint(uint64(Rnd(int64(segSize), 1<