diff options
| author | Russ Cox <rsc@golang.org> | 2014-09-16 17:39:55 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-09-16 17:39:55 -0400 |
| commit | 653fb6d872e31b05441f313911684d5cd351597e (patch) | |
| tree | 36061ebc305ff6f1b59aa05012aedb35091b968e /src/liblink | |
| parent | f1abe0d06bc94399c4abee041624efa36742fc1e (diff) | |
| download | go-653fb6d872e31b05441f313911684d5cd351597e.tar.xz | |
liblink: make GO_ARGS the default for functions beginning with ·
If there is a leading ·, assume there is a Go prototype and
attach the Go prototype information to the function.
If the function is not called from Go and does not need a
Go prototype, it can be made file-local instead (using name<>(SB)).
This fixes the current BSD build failures, by giving functions like
sync/atomic.StoreUint32 argument stack map information.
Fixes #8753.
LGTM=khr, iant
R=golang-codereviews, iant, khr, bradfitz
CC=golang-codereviews, r, rlh
https://golang.org/cl/142150043
Diffstat (limited to 'src/liblink')
| -rw-r--r-- | src/liblink/objfile.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c index 02cfae495a..7d4b28c9ac 100644 --- a/src/liblink/objfile.c +++ b/src/liblink/objfile.c @@ -125,7 +125,7 @@ static LSym *rdsym(Link*, Biobuf*, char*); void writeobj(Link *ctxt, Biobuf *b) { - int flag; + int flag, found; Hist *h; LSym *s, *text, *etext, *curtext, *data, *edata; Plist *pl; @@ -251,6 +251,27 @@ writeobj(Link *ctxt, Biobuf *b) s->etext = p; } } + + // Add reference to Go arguments for C or assembly functions without them. + for(s = text; s != nil; s = s->next) { + if(strncmp(s->name, "\"\".", 3) != 0) + continue; + found = 0; + for(p = s->text; p != nil; p = p->link) { + if(p->as == ctxt->arch->AFUNCDATA && p->from.type == ctxt->arch->D_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) { + found = 1; + break; + } + } + if(!found) { + p = appendp(ctxt, s->text); + p->as = ctxt->arch->AFUNCDATA; + p->from.type = ctxt->arch->D_CONST; + p->from.offset = FUNCDATA_ArgsPointerMaps; + p->to.type = ctxt->arch->D_EXTERN; + p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", s->name), s->version); + } + } // Turn functions into machine code images. for(s = text; s != nil; s = s->next) { |
