mirror of https://github.com/golang/go.git
cmd/ld: mark hostobj sections as containing no pointers
Currently they are scanned conservatively. But there is no reason to scan them. C world must not contain pointers into Go heap. Moreover, we don't have enough information to emit write barriers nor update pointers there in future. The immediate need is that it breaks the new GC because these are weird symbols as if with pointers but not necessary pointer aligned. LGTM=rsc R=golang-codereviews, rlh, rsc CC=golang-codereviews, iant, khr https://golang.org/cl/117000043
This commit is contained in:
parent
722764b75a
commit
65e2b6f847
|
|
@ -539,7 +539,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||
s->type = SRODATA;
|
||||
break;
|
||||
case ElfSectFlagAlloc + ElfSectFlagWrite:
|
||||
s->type = SDATA;
|
||||
s->type = SNOPTRDATA;
|
||||
break;
|
||||
case ElfSectFlagAlloc + ElfSectFlagExec:
|
||||
s->type = STEXT;
|
||||
|
|
@ -572,7 +572,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||
if(s->size < sym.size)
|
||||
s->size = sym.size;
|
||||
if(s->type == 0 || s->type == SXREF)
|
||||
s->type = SBSS;
|
||||
s->type = SNOPTRBSS;
|
||||
continue;
|
||||
}
|
||||
if(sym.shndx >= obj->nsect || sym.shndx == 0)
|
||||
|
|
|
|||
|
|
@ -589,10 +589,10 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||
s->type = SRODATA;
|
||||
} else {
|
||||
if (strcmp(sect->name, "__bss") == 0) {
|
||||
s->type = SBSS;
|
||||
s->type = SNOPTRBSS;
|
||||
s->np = 0;
|
||||
} else
|
||||
s->type = SDATA;
|
||||
s->type = SNOPTRDATA;
|
||||
}
|
||||
sect->sym = s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,10 +230,10 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||
s->type = SRODATA;
|
||||
break;
|
||||
case IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.bss
|
||||
s->type = SBSS;
|
||||
s->type = SNOPTRBSS;
|
||||
break;
|
||||
case IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.data
|
||||
s->type = SDATA;
|
||||
s->type = SNOPTRDATA;
|
||||
break;
|
||||
case IMAGE_SCN_CNT_CODE|IMAGE_SCN_MEM_EXECUTE|IMAGE_SCN_MEM_READ: //.text
|
||||
s->type = STEXT;
|
||||
|
|
@ -338,7 +338,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||
if(s->type == SDYNIMPORT)
|
||||
s->plt = -2; // flag for dynimport in PE object files.
|
||||
if (s->type == SXREF && sym->value > 0) {// global data
|
||||
s->type = SDATA;
|
||||
s->type = SNOPTRDATA;
|
||||
s->size = sym->value;
|
||||
}
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue