Skip to content

Commit 83515df

Browse files
committed
cmd/link: enable DWARF compression on Windows
Simple follow-on to CL 118276. Everything worked except that the compressed sections need to be aligned at PEFILEALIGN. Fixes #25927 Updates #11799 Change-Id: Iec871defe30e3e66055d64a5ae77d5a7aca355f5 Reviewed-on: https://go-review.googlesource.com/119816 Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Austin Clements <[email protected]>
1 parent 500293d commit 83515df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmd/link/internal/ld/dwarf.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ func dwarfaddelfsectionsyms(ctxt *Link) {
19511951
// relocations are applied. After this, dwarfp will contain a
19521952
// different (new) set of symbols, and sections may have been replaced.
19531953
func dwarfcompress(ctxt *Link) {
1954-
if !ctxt.IsELF || ctxt.LinkMode == LinkExternal {
1954+
if !(ctxt.IsELF || ctxt.HeadType == objabi.Hwindows) || ctxt.LinkMode == LinkExternal {
19551955
return
19561956
}
19571957

@@ -1998,6 +1998,10 @@ func dwarfcompress(ctxt *Link) {
19981998
log.Fatalf("%s: unexpected sub-symbols", s)
19991999
}
20002000
pos += uint64(s.Size)
2001+
if ctxt.HeadType == objabi.Hwindows {
2002+
pos = uint64(Rnd(int64(pos), PEFILEALIGN))
2003+
}
2004+
20012005
}
20022006
Segdwarf.Length = pos - Segdwarf.Vaddr
20032007
}

0 commit comments

Comments
 (0)