diff options
author | Russ Cox <rsc@golang.org> | 2014-04-14 15:54:20 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-04-14 15:54:20 -0400 |
commit | e8f7d40d36ebd0302f979efce335b531d67c7f3d (patch) | |
tree | 5c77311f9f013dcd93f6e07e7ced2b13ee2aab03 /src/liblink/objfile.c | |
parent | ea39a747252398dd95baa554526c3801e928d075 (diff) | |
download | go-e8f7d40d36ebd0302f979efce335b531d67c7f3d.tar.gz |
liblink: remove arch-specific constants from file format
The relocation and automatic variable types were using
arch-specific numbers. Introduce portable enumerations
instead.
To the best of my knowledge, these are the only arch-specific
bits left in the new object file format.
Remove now, before Go 1.3, because file formats are forever.
LGTM=iant
R=iant
CC=golang-codereviews
https://codereview.appspot.com/87670044
Diffstat (limited to 'src/liblink/objfile.c')
-rw-r--r-- | src/liblink/objfile.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c index f0f3f7622..2b11add3b 100644 --- a/src/liblink/objfile.c +++ b/src/liblink/objfile.c @@ -83,10 +83,7 @@ // - nfile [int] // - file [nfile symbol references] // -// The file layout is architecture-independent. -// The meaning is almost architecture-independent: -// the only field with architecture-dependent meaning is the -// relocation's type field. +// The file layout and meaning of type integers are architecture-independent. // // TODO(rsc): The file format is good for a first pass but needs work. // - There are SymID in the object file that should really just be strings. @@ -346,7 +343,12 @@ writesym(Link *ctxt, Biobuf *b, LSym *s) for(a = s->autom; a != nil; a = a->link) { wrsym(b, a->asym); wrint(b, a->aoffset); - wrint(b, a->type); + if(a->type == ctxt->arch->D_AUTO) + wrint(b, A_AUTO); + else if(a->type == ctxt->arch->D_PARAM) + wrint(b, A_PARAM); + else + sysfatal("%s: invalid local variable type %d", s->name, a->type); wrsym(b, a->gotype); } |