mirror of
https://github.com/golang/go
synced 2024-11-25 05:27:57 -07:00
runtime: separate out auto-generated files
R=golang-dev, r, r CC=golang-dev https://golang.org/cl/5493063
This commit is contained in:
parent
95907c4752
commit
bd9243da22
@ -246,4 +246,4 @@ endif
|
|||||||
$(CC) $(CFLAGS) -I . -o "$@" _obj/$*.c
|
$(CC) $(CFLAGS) -I . -o "$@" _obj/$*.c
|
||||||
|
|
||||||
%.$O: %.s $(HFILES)
|
%.$O: %.s $(HFILES)
|
||||||
$(AS) $*.s
|
$(AS) $(AFLAGS) $*.s
|
||||||
|
@ -8,9 +8,12 @@ all: install
|
|||||||
|
|
||||||
# Only build tools for current architecture, and only tools written in C.
|
# Only build tools for current architecture, and only tools written in C.
|
||||||
# The tools written in Go are managed by ../pkg/Makefile.
|
# The tools written in Go are managed by ../pkg/Makefile.
|
||||||
|
# We need all the C compilers for rebuilding generated files in runtime.
|
||||||
DIRS=\
|
DIRS=\
|
||||||
$(O)a\
|
$(O)a\
|
||||||
$(O)c\
|
5c\
|
||||||
|
6c\
|
||||||
|
8c\
|
||||||
$(O)g\
|
$(O)g\
|
||||||
$(O)l\
|
$(O)l\
|
||||||
cc\
|
cc\
|
||||||
@ -55,7 +58,7 @@ nuke: $(patsubst %,%.nuke,$(CLEANDIRS))
|
|||||||
@echo
|
@echo
|
||||||
$(MAKE) -C $* install
|
$(MAKE) -C $* install
|
||||||
|
|
||||||
gc.install $(O)c.install: cc.install
|
gc.install 5c.install 6c.install 8c.install: cc.install
|
||||||
$(O)g.install: gc.install
|
$(O)g.install: gc.install
|
||||||
$(O)a.install $(O)c.install $(O)g.install: $(O)l.install
|
$(O)a.install $(O)c.install $(O)g.install: $(O)l.install
|
||||||
|
|
||||||
|
@ -78,12 +78,18 @@ done
|
|||||||
bash "$GOROOT"/src/clean.bash
|
bash "$GOROOT"/src/clean.bash
|
||||||
|
|
||||||
# pkg builds libcgo and the Go programs in cmd.
|
# pkg builds libcgo and the Go programs in cmd.
|
||||||
for i in lib9 libbio libmach cmd pkg
|
for i in lib9 libbio libmach cmd
|
||||||
do
|
do
|
||||||
echo; echo; echo %%%% making $i %%%%; echo
|
echo; echo; echo %%%% making $i %%%%; echo
|
||||||
gomake -C $i install
|
gomake -C $i install
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo; echo; echo %%%% making runtime generated files %%%%; echo
|
||||||
|
gomake -C pkg/runtime -f Makefile.auto
|
||||||
|
|
||||||
|
echo; echo; echo %%%% making pkg%%%%; echo
|
||||||
|
gomake -C pkg install
|
||||||
|
|
||||||
# Print post-install messages.
|
# Print post-install messages.
|
||||||
# Implemented as a function so that all.bash can repeat the output
|
# Implemented as a function so that all.bash can repeat the output
|
||||||
# after run.bash finishes running all the tests.
|
# after run.bash finishes running all the tests.
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
include ../../Make.inc
|
include ../../Make.inc
|
||||||
|
|
||||||
# Go tool will do this for package runtime.
|
|
||||||
CFLAGS+=-DGOOS_$(GOOS) -DGOARCH_$(GOARCH)
|
|
||||||
|
|
||||||
TARG=runtime
|
TARG=runtime
|
||||||
|
|
||||||
GOFILES=\
|
GOFILES=\
|
||||||
@ -14,15 +11,13 @@ GOFILES=\
|
|||||||
error.go\
|
error.go\
|
||||||
extern.go\
|
extern.go\
|
||||||
mem.go\
|
mem.go\
|
||||||
runtime_defs.go\
|
|
||||||
sig.go\
|
sig.go\
|
||||||
softfloat64.go\
|
softfloat64.go\
|
||||||
type.go\
|
type.go\
|
||||||
version.go\
|
zgoarch_$(GOARCH).go\
|
||||||
version_$(GOOS).go\
|
zgoos_$(GOOS).go\
|
||||||
version_$(GOARCH).go\
|
zruntime_defs_$(GOOS)_$(GOARCH).go\
|
||||||
|
zversion.go\
|
||||||
CLEANFILES+=version.go version_*.go
|
|
||||||
|
|
||||||
OFILES_darwin=\
|
OFILES_darwin=\
|
||||||
lock_sema.$O\
|
lock_sema.$O\
|
||||||
@ -45,7 +40,7 @@ OFILES_plan9=\
|
|||||||
OFILES_windows=\
|
OFILES_windows=\
|
||||||
callback_windows_$(GOARCH).$O\
|
callback_windows_$(GOARCH).$O\
|
||||||
lock_sema.$O\
|
lock_sema.$O\
|
||||||
syscall_windows.$O\
|
zsyscall_windows_$(GOARCH).$O\
|
||||||
|
|
||||||
# 386-specific object files
|
# 386-specific object files
|
||||||
OFILES_386=\
|
OFILES_386=\
|
||||||
@ -66,6 +61,8 @@ OFILES_arm=\
|
|||||||
traceback_x86.$O\
|
traceback_x86.$O\
|
||||||
|
|
||||||
OFILES=\
|
OFILES=\
|
||||||
|
$(OFILES_$(GOARCH))\
|
||||||
|
$(OFILES_$(GOOS))\
|
||||||
alg.$O\
|
alg.$O\
|
||||||
asm_$(GOARCH).$O\
|
asm_$(GOARCH).$O\
|
||||||
atomic_$(GOARCH).$O\
|
atomic_$(GOARCH).$O\
|
||||||
@ -77,7 +74,6 @@ OFILES=\
|
|||||||
float.$O\
|
float.$O\
|
||||||
hashmap.$O\
|
hashmap.$O\
|
||||||
iface.$O\
|
iface.$O\
|
||||||
malloc.$O\
|
|
||||||
mcache.$O\
|
mcache.$O\
|
||||||
mcentral.$O\
|
mcentral.$O\
|
||||||
mem_$(GOOS).$O\
|
mem_$(GOOS).$O\
|
||||||
@ -86,31 +82,31 @@ OFILES=\
|
|||||||
mfixalloc.$O\
|
mfixalloc.$O\
|
||||||
mgc0.$O\
|
mgc0.$O\
|
||||||
mheap.$O\
|
mheap.$O\
|
||||||
mprof.$O\
|
|
||||||
msize.$O\
|
msize.$O\
|
||||||
print.$O\
|
print.$O\
|
||||||
proc.$O\
|
proc.$O\
|
||||||
rt0_$(GOOS)_$(GOARCH).$O\
|
rt0_$(GOOS)_$(GOARCH).$O\
|
||||||
rune.$O\
|
rune.$O\
|
||||||
runtime.$O\
|
runtime.$O\
|
||||||
runtime1.$O\
|
|
||||||
sema.$O\
|
|
||||||
signal_$(GOOS)_$(GOARCH).$O\
|
signal_$(GOOS)_$(GOARCH).$O\
|
||||||
sigqueue.$O\
|
|
||||||
slice.$O\
|
slice.$O\
|
||||||
string.$O\
|
|
||||||
symtab.$O\
|
symtab.$O\
|
||||||
sys_$(GOOS)_$(GOARCH).$O\
|
sys_$(GOOS)_$(GOARCH).$O\
|
||||||
thread_$(GOOS).$O\
|
thread_$(GOOS).$O\
|
||||||
time.$O\
|
zmalloc_$(GOARCH).$O\
|
||||||
$(OFILES_$(GOARCH))\
|
zmprof_$(GOARCH).$O\
|
||||||
$(OFILES_$(GOOS))\
|
zruntime1_$(GOARCH).$O\
|
||||||
|
zsema_$(GOARCH).$O\
|
||||||
|
zsigqueue_$(GOARCH).$O\
|
||||||
|
zstring_$(GOARCH).$O\
|
||||||
|
ztime_$(GOARCH).$O\
|
||||||
|
|
||||||
AUTOHFILES=\
|
AUTOHFILES=\
|
||||||
arch_GOARCH.h\
|
arch_GOARCH.h\
|
||||||
os_GOOS.h\
|
os_GOOS.h\
|
||||||
signals_GOOS.h\
|
signals_GOOS.h\
|
||||||
defs_GOOS_GOARCH.h\
|
defs_GOOS_GOARCH.h\
|
||||||
|
zasm_GOOS_GOARCH.h\
|
||||||
|
|
||||||
HFILES=\
|
HFILES=\
|
||||||
cgocall.h\
|
cgocall.h\
|
||||||
@ -126,6 +122,10 @@ GOFILES+=$(GOFILES_$(GOOS))
|
|||||||
# For use by cgo.
|
# For use by cgo.
|
||||||
INSTALLFILES=$(pkgdir)/runtime.h $(pkgdir)/cgocall.h
|
INSTALLFILES=$(pkgdir)/runtime.h $(pkgdir)/cgocall.h
|
||||||
|
|
||||||
|
# Go tool will do this for package runtime.
|
||||||
|
AFLAGS+=-DGOOS_$(GOOS) -DGOARCH_$(GOARCH)
|
||||||
|
CFLAGS+=-DGOOS_$(GOOS) -DGOARCH_$(GOARCH)
|
||||||
|
|
||||||
# special, out of the way compiler flag that means "add runtime metadata to output"
|
# special, out of the way compiler flag that means "add runtime metadata to output"
|
||||||
GC+= -+
|
GC+= -+
|
||||||
|
|
||||||
@ -138,44 +138,8 @@ $(pkgdir)/%.h: %.h
|
|||||||
clean: clean-local
|
clean: clean-local
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f goc2c mkversion version.go runtime.acid.* runtime_defs.go $$(ls *.goc | sed 's/goc$$/c/') $(AUTOHFILES)
|
rm -f $(AUTOHFILES)
|
||||||
|
make -f Makefile.auto clean
|
||||||
asm_$(GOARCH).h: mkasmh.sh runtime.acid.$(GOARCH)
|
|
||||||
./mkasmh.sh >$@.x
|
|
||||||
mv -f $@.x $@
|
|
||||||
|
|
||||||
goc2c: goc2c.c
|
|
||||||
quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"
|
|
||||||
|
|
||||||
mkversion: mkversion.c
|
|
||||||
quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"
|
|
||||||
|
|
||||||
version.go: mkversion
|
|
||||||
GOROOT="$(GOROOT_FINAL)" ./mkversion >version.go
|
|
||||||
|
|
||||||
version_$(GOARCH).go:
|
|
||||||
(echo 'package runtime'; echo 'const theGoarch = "$(GOARCH)"') >$@
|
|
||||||
|
|
||||||
version_$(GOOS).go:
|
|
||||||
(echo 'package runtime'; echo 'const theGoos = "$(GOOS)"') >$@
|
|
||||||
|
|
||||||
%.c: %.goc goc2c
|
|
||||||
./goc2c "`pwd`/$<" > $@.tmp
|
|
||||||
mv -f $@.tmp $@
|
|
||||||
|
|
||||||
# for discovering offsets inside structs when debugging
|
|
||||||
runtime.acid.$(GOARCH): runtime.h proc.c $(AUTOHFILES)
|
|
||||||
$(CC) $(CFLAGS) -a proc.c >$@
|
|
||||||
|
|
||||||
# 386 traceback is really amd64 traceback
|
|
||||||
ifeq ($(GOARCH),386)
|
|
||||||
traceback.$O: amd64/traceback.c
|
|
||||||
$(CC) $(CFLAGS) $<
|
|
||||||
endif
|
|
||||||
|
|
||||||
runtime_defs.go: proc.c iface.c hashmap.c chan.c $(HFILES)
|
|
||||||
CC="$(CC)" CFLAGS="$(CFLAGS)" ./mkgodefs.sh proc.c iface.c hashmap.c chan.c > $@.x
|
|
||||||
mv -f $@.x $@
|
|
||||||
|
|
||||||
arch_GOARCH.h: arch_$(GOARCH).h
|
arch_GOARCH.h: arch_$(GOARCH).h
|
||||||
cp $^ $@
|
cp $^ $@
|
||||||
@ -188,3 +152,6 @@ os_GOOS.h: os_$(GOOS).h
|
|||||||
|
|
||||||
signals_GOOS.h: signals_$(GOOS).h
|
signals_GOOS.h: signals_$(GOOS).h
|
||||||
cp $^ $@
|
cp $^ $@
|
||||||
|
|
||||||
|
zasm_GOOS_GOARCH.h: zasm_$(GOOS)_$(GOARCH).h
|
||||||
|
cp $^ $@
|
||||||
|
94
src/pkg/runtime/Makefile.auto
Normal file
94
src/pkg/runtime/Makefile.auto
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# Copyright 2011 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.
|
||||||
|
|
||||||
|
GOARCHES=\
|
||||||
|
386\
|
||||||
|
amd64\
|
||||||
|
arm\
|
||||||
|
|
||||||
|
GOOSES=\
|
||||||
|
darwin\
|
||||||
|
freebsd\
|
||||||
|
linux\
|
||||||
|
netbsd\
|
||||||
|
openbsd\
|
||||||
|
plan9\
|
||||||
|
windows\
|
||||||
|
|
||||||
|
GOOSARCHES=\
|
||||||
|
darwin_386\
|
||||||
|
darwin_amd64\
|
||||||
|
freebsd_386\
|
||||||
|
freebsd_amd64\
|
||||||
|
linux_386\
|
||||||
|
linux_amd64\
|
||||||
|
linux_arm\
|
||||||
|
netbsd_386\
|
||||||
|
netbsd_amd64\
|
||||||
|
openbsd_386\
|
||||||
|
openbsd_amd64\
|
||||||
|
plan9_386\
|
||||||
|
windows_386\
|
||||||
|
windows_amd64\
|
||||||
|
|
||||||
|
AUTO=\
|
||||||
|
$(GOARCHES:%=zmalloc_%.c)\
|
||||||
|
$(GOARCHES:%=zmprof_%.c)\
|
||||||
|
$(GOARCHES:%=zruntime1_%.c)\
|
||||||
|
$(GOARCHES:%=zsema_%.c)\
|
||||||
|
$(GOARCHES:%=zsigqueue_%.c)\
|
||||||
|
$(GOARCHES:%=zstring_%.c)\
|
||||||
|
$(GOARCHES:%=ztime_%.c)\
|
||||||
|
$(GOARCHES:%=zgoarch_%.go)\
|
||||||
|
$(GOOSES:%=zgoos_%.go)\
|
||||||
|
$(GOOSARCHES:%=zruntime_defs_%.go)\
|
||||||
|
$(GOOSARCHES:%=zasm_%.h)\
|
||||||
|
zsyscall_windows_386.c\
|
||||||
|
zsyscall_windows_amd64.c\
|
||||||
|
zversion.go\
|
||||||
|
|
||||||
|
all: auto
|
||||||
|
auto: $(AUTO)
|
||||||
|
|
||||||
|
# .goc -> .c (specific to os/arch combination)
|
||||||
|
goc2c: goc2c.c
|
||||||
|
quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"
|
||||||
|
|
||||||
|
z%_386.c: %.goc goc2c
|
||||||
|
GOARCH=386 ./goc2c "`pwd`/$<" >$@.tmp
|
||||||
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
|
z%_amd64.c: %.goc goc2c
|
||||||
|
GOARCH=amd64 ./goc2c "`pwd`/$<" >$@.tmp
|
||||||
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
|
z%_arm.c: %.goc goc2c
|
||||||
|
GOARCH=arm ./goc2c "`pwd`/$<" >$@.tmp
|
||||||
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
|
# version files
|
||||||
|
mkversion: mkversion.c ../../../lib/lib9.a
|
||||||
|
quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"
|
||||||
|
|
||||||
|
zversion.go: mkversion
|
||||||
|
GOROOT="$(GOROOT_FINAL)" ./mkversion >$@
|
||||||
|
|
||||||
|
zgoos_%.go:
|
||||||
|
(echo '// AUTO-GENERATED; run make -f Makefile.auto'; echo; echo 'package runtime'; echo; echo 'const theGoos = "$*"') >$@
|
||||||
|
|
||||||
|
zgoarch_%.go:
|
||||||
|
(echo '// AUTO-GENERATED; run make -f Makefile.auto'; echo; echo 'package runtime'; echo; echo 'const theGoarch = "$*"') >$@
|
||||||
|
|
||||||
|
# definitions of runtime structs, translated from C to Go
|
||||||
|
zruntime_defs_%.go: proc.c iface.c hashmap.c chan.c $(HFILES) mkgodefs.sh
|
||||||
|
./mkgodefs.sh $* proc.c iface.c hashmap.c chan.c >$@.tmp
|
||||||
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
|
# struct field offsets #defined for assembly
|
||||||
|
zasm_%.h: mkasmh.sh proc.c defs.h
|
||||||
|
./mkasmh.sh $* >$@.tmp
|
||||||
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f goc2c mkversion $(AUTO)
|
@ -2,7 +2,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.
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT _rt0_386(SB),7,$0
|
TEXT _rt0_386(SB),7,$0
|
||||||
// Linux, Windows start the FPU in extended double precision.
|
// Linux, Windows start the FPU in extended double precision.
|
||||||
|
@ -2,7 +2,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.
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT _rt0_amd64(SB),7,$-8
|
TEXT _rt0_amd64(SB),7,$-8
|
||||||
// copy arguments forward on an even stack
|
// copy arguments forward on an even stack
|
||||||
|
@ -2,7 +2,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.
|
||||||
|
|
||||||
#include "asm_arm.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// using frame size $-4 means do not save LR on stack.
|
// using frame size $-4 means do not save LR on stack.
|
||||||
TEXT _rt0_arm(SB),7,$-4
|
TEXT _rt0_arm(SB),7,$-4
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo -cdefs
|
Input to cgo -cdefs
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Input to cgo -cdefs
|
* Input to cgo -cdefs
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo.
|
Input to cgo.
|
||||||
On a Debian Lenny arm linux distribution:
|
On a Debian Lenny arm linux distribution:
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo.
|
Input to cgo.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo.
|
Input to cgo.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo -cdefs
|
Input to cgo -cdefs
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo.
|
Input to cgo.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo.
|
Input to cgo.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to cgo.
|
Input to cgo.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate a .goc file into a .c file. A .goc file is a combination
|
* Translate a .goc file into a .c file. A .goc file is a combination
|
||||||
* of a limited form of Go with C.
|
* of a limited form of Go with C.
|
||||||
@ -742,6 +744,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("// AUTO-GENERATED; run make\n\n");
|
||||||
process_file();
|
process_file();
|
||||||
exits(0);
|
exits(0);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build freebsd linux
|
||||||
|
|
||||||
#include "runtime.h"
|
#include "runtime.h"
|
||||||
|
|
||||||
// This implementation depends on OS-specific implementations of
|
// This implementation depends on OS-specific implementations of
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
// +build darwin netbsd openbsd plan9 windows
|
||||||
|
|
||||||
#include "runtime.h"
|
#include "runtime.h"
|
||||||
|
|
||||||
// This implementation depends on OS-specific implementations of
|
// This implementation depends on OS-specific implementations of
|
||||||
|
@ -5,9 +5,28 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
SYS=$1
|
||||||
|
export GOOS=$(echo $SYS | sed 's/_.*//')
|
||||||
|
export GOARCH=$(echo $SYS | sed 's/.*_//')
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$GOARCH" in
|
||||||
|
386) CC=8c;;
|
||||||
|
amd64) CC=6c;;
|
||||||
|
arm) CC=5c;;
|
||||||
|
esac
|
||||||
|
export CC
|
||||||
|
|
||||||
|
export CFLAGS="-Dos_$GOOS -Darch_$GOARCH"
|
||||||
|
|
||||||
|
cp arch_$GOARCH.h arch_GOARCH.h
|
||||||
|
cp defs_${GOOS}_$GOARCH.h defs_GOOS_GOARCH.h
|
||||||
|
cp os_$GOOS.h os_GOOS.h
|
||||||
|
cp signals_$GOOS.h signals_GOOS.h
|
||||||
|
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
// Assembly constants.
|
// Assembly constants.
|
||||||
// AUTOMATICALLY GENERATED BY mkasmh.sh DURING BUILD
|
// AUTO-GENERATED; run make -f Makefile.auto
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -91,6 +110,7 @@ arm)
|
|||||||
esac
|
esac
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
$CC $CFLAGS -a proc.c |
|
||||||
awk '
|
awk '
|
||||||
{ gsub(/\r/, ""); }
|
{ gsub(/\r/, ""); }
|
||||||
/^aggr G$/ { aggr="g" }
|
/^aggr G$/ { aggr="g" }
|
||||||
@ -109,5 +129,6 @@ aggr != "" && /^ / {
|
|||||||
offset=$(NF-1);
|
offset=$(NF-1);
|
||||||
printf("#define %s_%s %s\n", aggr, name, offset);
|
printf("#define %s_%s %s\n", aggr, name, offset);
|
||||||
}
|
}
|
||||||
' runtime.acid.$GOARCH
|
'
|
||||||
|
|
||||||
|
rm -f arch_GOARCH.h defs_GOOS_GOARCH.h os_GOOS.h signals_GOOS.h
|
||||||
|
@ -5,10 +5,28 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
SYS=$1
|
||||||
|
export GOOS=$(echo $SYS | sed 's/_.*//')
|
||||||
|
export GOARCH=$(echo $SYS | sed 's/.*_//')
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$GOARCH" in
|
||||||
|
386) CC=8c;;
|
||||||
|
amd64) CC=6c;;
|
||||||
|
arm) CC=5c;;
|
||||||
|
esac
|
||||||
|
export CC
|
||||||
|
|
||||||
|
export CFLAGS="-DGOOS_$GOOS -DGOARCH_$GOARCH"
|
||||||
|
|
||||||
|
cp arch_$GOARCH.h arch_GOARCH.h
|
||||||
|
cp defs_${GOOS}_$GOARCH.h defs_GOOS_GOARCH.h
|
||||||
|
cp os_$GOOS.h os_GOOS.h
|
||||||
|
cp signals_$GOOS.h signals_GOOS.h
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
// Go definitions for C variables and types.
|
// Go definitions for C variables and types.
|
||||||
// AUTOMATICALLY GENERATED BY THE FOLLOWING COMMAND. DO NOT EDIT.
|
// AUTO-GENERATED; run make -f Makefile.auto
|
||||||
// CC="$CC" CFLAGS="$CFLAGS" ./mkgodefs.sh $@
|
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
@ -37,3 +55,5 @@ skip {
|
|||||||
|
|
||||||
{print}
|
{print}
|
||||||
'
|
'
|
||||||
|
|
||||||
|
rm -f arch_GOARCH.h defs_GOOS_GOARCH.h os_GOOS.h signals_GOOS.h
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
|
||||||
char *template =
|
char *template =
|
||||||
"// generated by mkversion.c; do not edit.\n"
|
"// AUTO-GENERATED; run make -f Makefile.auto\n\n"
|
||||||
"package runtime\n"
|
"package runtime\n"
|
||||||
"const defaultGoroot = `%s`\n"
|
"const defaultGoroot = `%s`\n"
|
||||||
"const theVersion = \"%s\"\n";
|
"const theVersion = \"%s\"\n";
|
||||||
|
@ -2,7 +2,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.
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT _rt0_amd64_windows(SB),7,$-8
|
TEXT _rt0_amd64_windows(SB),7,$-8
|
||||||
MOVQ $_rt0_amd64(SB), AX
|
MOVQ $_rt0_amd64(SB), AX
|
||||||
|
@ -152,7 +152,7 @@ sigaction(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
|
|||||||
sa.sa_flags |= SA_RESTART;
|
sa.sa_flags |= SA_RESTART;
|
||||||
sa.sa_mask = ~0ULL;
|
sa.sa_mask = ~0ULL;
|
||||||
sa.sa_tramp = runtime·sigtramp; // runtime·sigtramp's job is to call into real handler
|
sa.sa_tramp = runtime·sigtramp; // runtime·sigtramp's job is to call into real handler
|
||||||
*(uintptr*)&sa.__sigaction_u = (uintptr)fn;
|
*(uintptr*)sa.__sigaction_u = (uintptr)fn;
|
||||||
runtime·sigaction(i, &sa, nil);
|
runtime·sigaction(i, &sa, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// See http://fxr.watson.org/fxr/source/bsd/kern/syscalls.c?v=xnu-1228
|
// See http://fxr.watson.org/fxr/source/bsd/kern/syscalls.c?v=xnu-1228
|
||||||
// or /usr/include/sys/syscall.h (on a Mac) for system call numbers.
|
// or /usr/include/sys/syscall.h (on a Mac) for system call numbers.
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT runtime·notok(SB),7,$0
|
TEXT runtime·notok(SB),7,$0
|
||||||
MOVL $0xf1, 0xf1
|
MOVL $0xf1, 0xf1
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
// The high 8 bits specify the kind of system call: 1=Mach, 2=BSD, 3=Machine-Dependent.
|
// The high 8 bits specify the kind of system call: 1=Mach, 2=BSD, 3=Machine-Dependent.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// Exit the entire program (like C exit)
|
// Exit the entire program (like C exit)
|
||||||
TEXT runtime·exit(SB),7,$0
|
TEXT runtime·exit(SB),7,$0
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT runtime·sys_umtx_op(SB),7,$-4
|
TEXT runtime·sys_umtx_op(SB),7,$-4
|
||||||
MOVL $454, AX
|
MOVL $454, AX
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT runtime·sys_umtx_op(SB),7,$0
|
TEXT runtime·sys_umtx_op(SB),7,$0
|
||||||
MOVQ 8(SP), DI
|
MOVQ 8(SP), DI
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// System calls and other sys.stuff for 386, Linux
|
// System calls and other sys.stuff for 386, Linux
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT runtime·exit(SB),7,$0
|
TEXT runtime·exit(SB),7,$0
|
||||||
MOVL $252, AX // syscall number
|
MOVL $252, AX // syscall number
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// System calls and other sys.stuff for AMD64, Linux
|
// System calls and other sys.stuff for AMD64, Linux
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
TEXT runtime·exit(SB),7,$0-8
|
TEXT runtime·exit(SB),7,$0-8
|
||||||
MOVL 8(SP), DI
|
MOVL 8(SP), DI
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// System calls and other sys.stuff for arm, Linux
|
// System calls and other sys.stuff for arm, Linux
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_arm.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// OABI
|
// OABI
|
||||||
//#define SYS_BASE 0x00900000
|
//#define SYS_BASE 0x00900000
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// Exit the entire program (like C exit)
|
// Exit the entire program (like C exit)
|
||||||
TEXT runtime·exit(SB),7,$-4
|
TEXT runtime·exit(SB),7,$-4
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// int64 rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
|
// int64 rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
|
||||||
TEXT runtime·rfork_thread(SB),7,$0
|
TEXT runtime·rfork_thread(SB),7,$0
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// Exit the entire program (like C exit)
|
// Exit the entire program (like C exit)
|
||||||
TEXT runtime·exit(SB),7,$-4
|
TEXT runtime·exit(SB),7,$-4
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// int64 rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
|
// int64 rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
|
||||||
TEXT runtime·rfork_thread(SB),7,$0
|
TEXT runtime·rfork_thread(SB),7,$0
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "defs_GOOS_GOARCH.h"
|
#include "defs_GOOS_GOARCH.h"
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// setldt(int entry, int address, int limit)
|
// setldt(int entry, int address, int limit)
|
||||||
TEXT runtime·setldt(SB),7,$0
|
TEXT runtime·setldt(SB),7,$0
|
||||||
|
@ -2,7 +2,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.
|
||||||
|
|
||||||
#include "asm_386.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// void runtime·asmstdcall(void *c);
|
// void runtime·asmstdcall(void *c);
|
||||||
TEXT runtime·asmstdcall(SB),7,$0
|
TEXT runtime·asmstdcall(SB),7,$0
|
||||||
|
@ -2,7 +2,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.
|
||||||
|
|
||||||
#include "asm_amd64.h"
|
#include "zasm_GOOS_GOARCH.h"
|
||||||
|
|
||||||
// maxargs should be divisible by 2, as Windows stack
|
// maxargs should be divisible by 2, as Windows stack
|
||||||
// must be kept 16-byte aligned on syscall entry.
|
// must be kept 16-byte aligned on syscall entry.
|
||||||
|
Loading…
Reference in New Issue
Block a user