mirror of
https://github.com/golang/go.git
synced 2025-11-08 12:41:02 +00:00
add plan 9 ar, which understands our symbol tables
SVN=124761
This commit is contained in:
parent
e90ae879d6
commit
250a091922
6 changed files with 1309 additions and 1 deletions
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
|
# 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
|
||||||
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
|
||||||
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)
|
||||||
{
|
{
|
||||||
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)
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue