1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:04:46 -07:00

cmd/cgo: use 1 as last entry for __cgodebug_data

LLVM-based gcc will place all-zero data in a zero-filled
        section, but our debug/macho can't handle that.
        Fixes #3821.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6444049
This commit is contained in:
Shenghou Ma 2012-07-30 18:44:48 -04:00
parent 7520f0b4aa
commit dd62bb4753

View File

@ -508,7 +508,12 @@ func (p *Package) loadDWARF(f *File, names []*Name) {
fmt.Fprintf(&b, "\t0,\n")
}
}
fmt.Fprintf(&b, "\t0\n")
// for the last entry, we can not use 0, otherwise
// in case all __cgodebug_data is zero initialized,
// LLVM-based gcc will place the it in the __DATA.__common
// zero-filled section (our debug/macho doesn't support
// this)
fmt.Fprintf(&b, "\t1\n")
fmt.Fprintf(&b, "};\n")
d, bo, debugData := p.gccDebug(b.Bytes())