1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:57:58 -07:00

put a makefile into runtime

make the runtime library an archive (rt0 is still separate)
update 6l to use the archive
add fakeobj.c, missing from prior change

SVN=124762
This commit is contained in:
Rob Pike 2008-06-25 21:19:05 -07:00
parent 250a091922
commit c87597de2c
6 changed files with 86 additions and 23 deletions

View File

@ -364,15 +364,11 @@ main(int argc, char *argv[])
if(!debug['l']) {
loadlib();
/* BUG: these should be an archive or pulled via pragmas in rt0_*.6 */
a = mal(strlen(goroot)+strlen(goarch)+20);
sprint(a, "%s/lib/rt_%s.6", goroot, goarch);
objfile(a);
a = mal(strlen(goroot)+strlen(goarch)+strlen(goos)+20);
sprint(a, "%s/lib/rt1_%s_%s.6", goroot, goarch, goos);
objfile(a);
a = mal(strlen(goroot)+strlen(goarch)+20);
sprint(a, "%s/lib/rt2_%s.6", goroot, goarch);
sprint(a, "%s/lib/lib_%s_%s.a", goroot, goarch, goos);
objfile(a);
}

View File

@ -10,7 +10,7 @@ O=o
# We call the binary 6ar to avoid confusion and because this binary
# is linked only with amd64 and x86 support.
TARG=6ar
TARG=$(O)ar
OFILES=\
ar.$O\

View File

@ -0,0 +1,33 @@
// 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.
/*
* obj.c
* routines universal to all object files
*/
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ar.h>
#include <mach_amd64.h>
#include "obj.h"
int _is2(char* x) { return 0; }
int _is5(char* x) { return 0; }
int _is7(char* x) { return 0; }
int _is8(char* x) { return 0; }
int _is9(char* x) { return 0; }
int _isk(char* x) { return 0; }
int _isq(char* x) { return 0; }
int _isv(char* x) { return 0; }
int _isu(char* x) { return 0; }
int _read2(Biobuf* b, Prog* p) { return 0; }
int _read5(Biobuf* b, Prog* p) { return 0; }
int _read7(Biobuf* b, Prog* p) { return 0; }
int _read8(Biobuf* b, Prog* p) { return 0; }
int _read9(Biobuf* b, Prog* p) { return 0; }
int _readk(Biobuf* b, Prog* p) { return 0; }
int _readq(Biobuf* b, Prog* p) { return 0; }
int _readv(Biobuf* b, Prog* p) { return 0; }
int _readu(Biobuf* b, Prog* p) { return 0; }

40
src/runtime/Makefile Normal file
View File

@ -0,0 +1,40 @@
# 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=
O=6
CC=$(O)c
AS=$(O)a
LIB=lib_$(GOARCH)_$(GOOS).a
RT0OFILES=\
rt0_$(GOARCH)_$(GOOS).$O\
LIBOFILES=\
rt1_$(GOARCH)_$(GOOS).$O\
rt2_$(GOARCH).$O\
OFILES=$(RT0OFILES) $(LIBOFILES)
HFILES=
install: rt0 $(LIB)
cp $(RT0OFILES) $(GOROOT)/lib
cp $(LIB) $(GOROOT)/lib
rt0: $(RT0OFILES)
$(LIB): $(LIBOFILES)
$(O)ar rc $(LIB) $(LIBOFILES)
$(OFILES): $(HFILES)
clean:
rm -f *.$(O) *.a
%.$O: %.c
$(CC) $<
%.$O: %.s
$(AS) $<

View File

@ -2,4 +2,10 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
echo nothing to clean here
set -ex
for GOOS in linux darwin
do
make clean
done

View File

@ -4,20 +4,8 @@
set -ex
$HOME/bin/6a rt0_amd64_darwin.s
mv rt0_amd64_darwin.6 ../../lib/rt0_amd64_darwin.6
for GOOS in linux darwin
do
make install
done
$HOME/bin/6a rt0_amd64_linux.s
mv rt0_amd64_linux.6 ../../lib/rt0_amd64_linux.6
$HOME/bin/6c rt1_amd64_linux.c
mv rt1_amd64_linux.6 ../../lib/rt1_amd64_linux.6
$HOME/bin/6c rt1_amd64_darwin.c
mv rt1_amd64_darwin.6 ../../lib/rt1_amd64_darwin.6
$HOME/bin/6c rt2_amd64.c
mv rt2_amd64.6 ../../lib/rt2_amd64.6
$HOME/bin/6c runtime.c
mv runtime.6 ../../lib/rt_amd64.6