mirror of
https://github.com/golang/go
synced 2024-10-06 16:10:03 +00:00
liblink: fix field tracking
The USEFIELD instructions no longer make it to the linker, so we have to do something else to pin the references they were pinning. Emit a 0-length relocation of type R_USEFIELD. Fixes #7486. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://golang.org/cl/95530043
This commit is contained in:
parent
6aee29648f
commit
d9c9665f1d
|
@ -243,6 +243,7 @@ enum
|
|||
R_PLT0,
|
||||
R_PLT1,
|
||||
R_PLT2,
|
||||
R_USEFIELD,
|
||||
};
|
||||
|
||||
// Auto.type
|
||||
|
|
|
@ -3443,6 +3443,15 @@ asmins(Link *ctxt, Prog *p)
|
|||
ctxt->andptr = ctxt->and;
|
||||
ctxt->asmode = p->mode;
|
||||
|
||||
if(p->as == AUSEFIELD) {
|
||||
r = addrel(ctxt->cursym);
|
||||
r->off = 0;
|
||||
r->siz = 0;
|
||||
r->sym = p->from.sym;
|
||||
r->type = R_USEFIELD;
|
||||
return;
|
||||
}
|
||||
|
||||
if(ctxt->headtype == Hnacl) {
|
||||
if(p->as == AREP) {
|
||||
ctxt->rep++;
|
||||
|
|
|
@ -2744,7 +2744,18 @@ static uchar naclret[] = {
|
|||
static void
|
||||
asmins(Link *ctxt, Prog *p)
|
||||
{
|
||||
Reloc *r;
|
||||
|
||||
ctxt->andptr = ctxt->and;
|
||||
|
||||
if(p->as == AUSEFIELD) {
|
||||
r = addrel(ctxt->cursym);
|
||||
r->off = 0;
|
||||
r->sym = p->from.sym;
|
||||
r->type = R_USEFIELD;
|
||||
r->siz = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(ctxt->headtype == Hnacl) {
|
||||
switch(p->as) {
|
||||
|
|
Loading…
Reference in a new issue