1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:54:43 -07:00

cmd/ld: support zero-filled section for Mach-O files

R=golang-dev, r, dave, rsc
CC=golang-dev
https://golang.org/cl/6492069
This commit is contained in:
Shenghou Ma 2012-09-02 04:50:58 +08:00
parent 1c2021ca14
commit c5444a8937

View File

@ -573,9 +573,14 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
goto bad; goto bad;
} }
free(name); free(name);
s->p = dat + sect->addr - c->seg.vmaddr;
s->np = sect->size; s->np = sect->size;
s->size = s->np; s->size = s->np;
if((sect->flags & 0xff) == 1) // S_ZEROFILL
s->p = mal(s->size);
else {
s->p = dat + sect->addr - c->seg.vmaddr;
}
if(strcmp(sect->segname, "__TEXT") == 0) { if(strcmp(sect->segname, "__TEXT") == 0) {
if(strcmp(sect->name, "__text") == 0) if(strcmp(sect->name, "__text") == 0)