mirror of
https://github.com/golang/go.git
synced 2024-09-30 14:57:10 +00:00
add plan 9 ar, which understands our symbol tables
SVN=124761
This commit is contained in:
parent
e90ae879d6
commit
250a091922
24
src/cmd/ar/Makefile
Normal file
24
src/cmd/ar/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
# 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)
|
1246
src/cmd/ar/ar.c
Normal file
1246
src/cmd/ar/ar.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# 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
|
||||
cd $i
|
||||
make clean
|
||||
|
@ -41,6 +41,11 @@ cd 6g
|
||||
make install
|
||||
cd ..
|
||||
|
||||
echo; echo; echo %%%% making ar %%%%; echo
|
||||
cd ar
|
||||
make install
|
||||
cd ..
|
||||
|
||||
echo; echo; echo %%%% making db %%%%; echo
|
||||
cd db
|
||||
make install
|
||||
|
@ -32,6 +32,7 @@ O=o
|
||||
LIB=libmach_amd64.a
|
||||
OFILES=\
|
||||
executable.$O\
|
||||
fakeobj.$O\
|
||||
map.$O\
|
||||
obj.$O\
|
||||
swap.$O\
|
||||
|
@ -113,7 +113,9 @@ objtype(Biobuf *bp, char **name)
|
||||
{
|
||||
int i;
|
||||
char buf[MAXIS];
|
||||
int c;
|
||||
|
||||
Retry:
|
||||
if(Bread(bp, buf, MAXIS) < MAXIS)
|
||||
return -1;
|
||||
Bseek(bp, -MAXIS, 1);
|
||||
@ -124,6 +126,36 @@ objtype(Biobuf *bp, char **name)
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user