From 8d39e55c6516be5ee3267b8ce101b324a4f09986 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 14 Apr 2014 15:54:20 -0400 Subject: 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://golang.org/cl/87670044 --- src/liblink/objfile.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/liblink/objfile.c') diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c index f0f3f76223..2b11add3b6 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); } -- cgit v1.3-5-g9baa