Commit 250a0919 authored by Rob Pike's avatar Rob Pike

add plan 9 ar, which understands our symbol tables

SVN=124761
parent e90ae879
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
CFLAGS=-I$(GOROOT)/include
BIN=$(HOME)/bin
O=o
# The directory is ar because the source is portable and general.
# We call the binary 6ar to avoid confusion and because this binary
# is linked only with amd64 and x86 support.
TARG=6ar
OFILES=\
ar.$O\
$(TARG): $(OFILES)
cc -o $(TARG) -L$(GOROOT)/lib $(OFILES) -lmach_amd64 -lbio -l9
clean:
rm -f $(OFILES) $(TARG)
install: $(TARG)
cp $(TARG) $(BIN)/$(TARG)
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
for i in 6l 6a 6c 6g gc cc db for i in 6l 6a 6c 6g gc cc ar db
do do
cd $i cd $i
make clean make clean
......
...@@ -41,6 +41,11 @@ cd 6g ...@@ -41,6 +41,11 @@ cd 6g
make install make install
cd .. cd ..
echo; echo; echo %%%% making ar %%%%; echo
cd ar
make install
cd ..
echo; echo; echo %%%% making db %%%%; echo echo; echo; echo %%%% making db %%%%; echo
cd db cd db
make install make install
......
...@@ -32,6 +32,7 @@ O=o ...@@ -32,6 +32,7 @@ O=o
LIB=libmach_amd64.a LIB=libmach_amd64.a
OFILES=\ OFILES=\
executable.$O\ executable.$O\
fakeobj.$O\
map.$O\ map.$O\
obj.$O\ obj.$O\
swap.$O\ swap.$O\
......
...@@ -113,7 +113,9 @@ objtype(Biobuf *bp, char **name) ...@@ -113,7 +113,9 @@ objtype(Biobuf *bp, char **name)
{ {
int i; int i;
char buf[MAXIS]; char buf[MAXIS];
int c;
Retry:
if(Bread(bp, buf, MAXIS) < MAXIS) if(Bread(bp, buf, MAXIS) < MAXIS)
return -1; return -1;
Bseek(bp, -MAXIS, 1); Bseek(bp, -MAXIS, 1);
...@@ -124,6 +126,36 @@ objtype(Biobuf *bp, char **name) ...@@ -124,6 +126,36 @@ objtype(Biobuf *bp, char **name)
return i; return i;
} }
} }
/*
* Maybe there's an import block we need to skip
*/
for(i = 0; i < MAXIS; i++) {
if(isalpha(buf[i]) || isdigit(buf[i]))
continue;
if(i == 0 || buf[i] != '\n')
return -1;
break;
}
/*
* Found one. Skip until "\n!\n"
*/
while((c = Bgetc(bp)) != Beof) {
if(c != '\n')
continue;
c = Bgetc(bp);
if(c != '!'){
Bungetc(bp);
continue;
}
c = Bgetc(bp);
if(c != '\n'){
Bungetc(bp);
continue;
}
goto Retry;
}
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment