1
0
mirror of https://github.com/golang/go synced 2024-11-19 15:44:44 -07:00

runtime: make more build-friendly

Collapse the arch,os-specific directories into the main directory
by renaming xxx/foo.c to foo_xxx.c, and so on.

There are no substantial edits here, except to the Makefile.
The assumption is that the Go tool will #define GOOS_darwin
and GOARCH_amd64 and will make any file named something
like signals_darwin.h available as signals_GOOS.h during the
build.  This replaces what used to be done with -I$(GOOS).

There is still work to be done to make runtime build with
standard tools, but this is a big step.  After this we will have
to write a script to generate all the generated files so they
can be checked in (instead of generated during the build).

R=r, iant, r, lucio.dere
CC=golang-dev
https://golang.org/cl/5490053
This commit is contained in:
Russ Cox 2011-12-16 15:33:58 -05:00
parent 474d64d26e
commit 851f30136d
141 changed files with 172 additions and 176 deletions

View File

@ -4,17 +4,11 @@
include ../../Make.inc
# Go tool will do this for package runtime.
CFLAGS+=-DGOOS_$(GOOS) -DGOARCH_$(GOARCH)
TARG=runtime
# Set SIZE to 32 or 64.
SIZE_386=32
SIZE_amd64=64
SIZE_arm=32
SIZE=$(SIZE_$(GOARCH))
CFLAGS_windows=-D__WINDOWS__
CFLAGS=-I$(GOOS) -I$(GOARCH) -I$(GOOS)/$(GOARCH) -FVw $(CFLAGS_$(GOARCH)) $(CFLAGS_$(GOOS))
GOFILES=\
debug.go\
error.go\
@ -49,29 +43,29 @@ OFILES_plan9=\
lock_sema.$O\
OFILES_windows=\
callback.$O\
callback_windows_$(GOARCH).$O\
lock_sema.$O\
syscall.$O\
syscall_windows.$O\
# 386-specific object files
OFILES_386=\
vlop.$O\
vlrt.$O\
vlop_386.$O\
vlrt_386.$O\
# arm-specific object files
OFILES_arm=\
memset.$O\
softfloat.$O\
vlop.$O\
vlrt.$O\
memset_arm.$O\
softfloat_arm.$O\
vlop_arm.$O\
vlrt_arm.$O\
OFILES=\
alg.$O\
asm.$O\
atomic.$O\
asm_$(GOARCH).$O\
atomic_$(GOARCH).$O\
cgocall.$O\
chan.$O\
closure.$O\
closure_$(GOARCH).$O\
complex.$O\
cpuprof.$O\
float.$O\
@ -80,8 +74,8 @@ OFILES=\
malloc.$O\
mcache.$O\
mcentral.$O\
mem.$O\
memmove.$O\
mem_$(GOOS).$O\
memmove_$(GOARCH).$O\
mfinal.$O\
mfixalloc.$O\
mgc0.$O\
@ -90,33 +84,36 @@ OFILES=\
msize.$O\
print.$O\
proc.$O\
rt0.$O\
rt0_$(GOOS)_$(GOARCH).$O\
rune.$O\
runtime.$O\
runtime1.$O\
sema.$O\
signal.$O\
signal_$(GOOS)_$(GOARCH).$O\
sigqueue.$O\
slice.$O\
string.$O\
symtab.$O\
sys.$O\
thread.$O\
sys_$(GOOS)_$(GOARCH).$O\
thread_$(GOOS).$O\
time.$O\
traceback.$O\
traceback_$(GOARCH).$O\
$(OFILES_$(GOARCH))\
$(OFILES_$(GOOS))\
AUTOHFILES=\
arch_GOARCH.h\
os_GOOS.h\
signals_GOOS.h\
defs_GOOS_GOARCH.h\
HFILES=\
cgocall.h\
runtime.h\
hashmap.h\
malloc.h\
stack.h\
$(GOARCH)/asm.h\
$(GOOS)/os.h\
$(GOOS)/signals.h\
$(GOOS)/$(GOARCH)/defs.h\
$(AUTOHFILES)\
GOFILES+=$(GOFILES_$(GOOS))
@ -135,9 +132,9 @@ $(pkgdir)/%.h: %.h
clean: clean-local
clean-local:
rm -f goc2c mkversion version.go */asm.h runtime.acid.* runtime_defs.go $$(ls *.goc | sed 's/goc$$/c/')
rm -f goc2c mkversion version.go runtime.acid.* runtime_defs.go $$(ls *.goc | sed 's/goc$$/c/') $(AUTOHFILES)
$(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
asm_$(GOARCH).h: mkasmh.sh runtime.acid.$(GOARCH)
./mkasmh.sh >$@.x
mv -f $@.x $@
@ -160,20 +157,7 @@ version_$(GOOS).go:
./goc2c "`pwd`/$<" > $@.tmp
mv -f $@.tmp $@
%.$O: $(GOARCH)/%.c $(HFILES)
$(CC) $(CFLAGS) $<
%.$O: $(GOOS)/%.c $(HFILES)
$(CC) $(CFLAGS) $<
%.$O: $(GOOS)/$(GOARCH)/%.c $(HFILES)
$(CC) $(CFLAGS) $<
%.$O: $(GOARCH)/%.s $(GOARCH)/asm.h
$(AS) $<
%.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
$(AS) $<
%.$O: asm_$(GOARCH).h
# for discovering offsets inside structs when debugging
runtime.acid.$(GOARCH): runtime.h proc.c
@ -185,6 +169,18 @@ traceback.$O: amd64/traceback.c
$(CC) $(CFLAGS) $<
endif
runtime_defs.go: proc.c iface.c hashmap.c chan.c
CC="$(CC)" CFLAGS="$(CFLAGS)" ./mkgodefs.sh $^ > $@.x
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
cp $^ $@
defs_GOOS_GOARCH.h: defs_$(GOOS)_$(GOARCH).h
cp $^ $@
os_GOOS.h: os_$(GOOS).h
cp $^ $@
signals_GOOS.h: signals_$(GOOS).h
cp $^ $@

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "386/asm.h"
#include "asm_386.h"
TEXT _rt0_386(SB),7,$0
// Linux, Windows start the FPU in extended double precision.

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "amd64/asm.h"
#include "asm_amd64.h"
TEXT _rt0_amd64(SB),7,$-8
// copy arguments forward on an even stack

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "arm/asm.h"
#include "asm_arm.h"
// using frame size $-4 means do not save LR on stack.
TEXT _rt0_arm(SB),7,$-4

View File

@ -4,8 +4,8 @@
#include "runtime.h"
#include "type.h"
#include "defs.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
// Will keep all callbacks in a linked list, so they don't get garbage collected.
typedef struct Callback Callback;

View File

@ -4,8 +4,8 @@
#include "runtime.h"
#include "type.h"
#include "defs.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
// Will keep all callbacks in a linked list, so they don't get garbage collected.
typedef struct Callback Callback;

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "stack.h"
#include "cgocall.h"

View File

@ -49,7 +49,7 @@
// in the situation when normally the goroutine "owns" handoff.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
enum

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "type.h"
#include "malloc.h"

View File

@ -8,10 +8,10 @@
package runtime
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "stack.h"
#include "malloc.h"
#include "defs.h"
#include "defs_GOOS_GOARCH.h"
#include "type.h"
MHeap runtime·mheap;

View File

@ -7,7 +7,7 @@
// See malloc.h for an overview.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
void*

View File

@ -15,7 +15,7 @@
// so that it is faster to move those lists between MCaches and MCentrals.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
static bool MCentral_Grow(MCentral *c);

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "defs.h"
#include "os.h"
#include "arch_GOARCH.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "malloc.h"
void*

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "defs.h"
#include "os.h"
#include "arch_GOARCH.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "malloc.h"
void*

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "defs.h"
#include "os.h"
#include "arch_GOARCH.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "malloc.h"
enum

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "defs.h"
#include "os.h"
#include "arch_GOARCH.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "malloc.h"
enum

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "defs.h"
#include "os.h"
#include "arch_GOARCH.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "malloc.h"
enum

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
#include "os.h"
#include "os_GOOS.h"
extern byte end[];
static byte *bloc = { end };

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "os.h"
#include "defs.h"
#include "arch_GOARCH.h"
#include "os_GOOS.h"
#include "defs_GOOS_GOARCH.h"
#include "malloc.h"
enum {

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
enum { debug = 0 };

View File

@ -7,7 +7,7 @@
// See malloc.h for overview.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
// Initialize f to allocate objects of the given size,

View File

@ -5,7 +5,7 @@
// Garbage collector.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
#include "stack.h"

View File

@ -13,7 +13,7 @@
// and heapmap(i) == span for all s->start <= i < s->start+s->npages.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
static MSpan *MHeap_AllocLocked(MHeap*, uintptr, int32);

View File

@ -7,9 +7,9 @@
package runtime
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
#include "defs.h"
#include "defs_GOOS_GOARCH.h"
#include "type.h"
// NOTE(rsc): Everything here could use cas if contention became an issue.

View File

@ -26,7 +26,7 @@
// TODO(rsc): Compute max waste for any given size.
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
#include "malloc.h"
int32 runtime·class_to_size[NumSizeClasses];

View File

@ -3,10 +3,10 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "arch.h"
#include "defs.h"
#include "arch_GOARCH.h"
#include "defs_GOOS_GOARCH.h"
#include "malloc.h"
#include "os.h"
#include "os_GOOS.h"
#include "stack.h"
bool runtime·iscgo;

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "amd64/asm.h"
#include "asm_amd64.h"
TEXT _rt0_amd64_windows(SB),7,$-8
MOVQ $_rt0_amd64(SB), AX

View File

@ -241,7 +241,7 @@ struct M
uint32 waitsemacount;
uint32 waitsemalock;
#ifdef __WINDOWS__
#ifdef GOOS_windows
void* thread; // thread handle
#endif
uintptr end[];
@ -299,7 +299,7 @@ struct WinCall
uintptr err; // error number
};
#ifdef __WINDOWS__
#ifdef GOOS_windows
enum {
Windows = 1
};

View File

@ -19,7 +19,7 @@
package runtime
#include "runtime.h"
#include "arch.h"
#include "arch_GOARCH.h"
typedef struct Sema Sema;
struct Sema

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "os.h"
#include "signals.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "signals_GOOS.h"
void
runtime·dumpregs(Regs32 *r)

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "os.h"
#include "signals.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "signals_GOOS.h"
void
runtime·dumpregs(Regs64 *r)

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
extern void runtime·sigtramp(void);

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
extern void runtime·sigtramp(void);

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
void
runtime·dumpregs(Sigcontext *r)

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
void
runtime·dumpregs(Sigcontext *r)

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
void
runtime·dumpregs(Sigcontext *r)

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
extern void runtime·sigtramp(void);

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
extern void runtime·sigtramp(void);

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
extern void runtime·sigtramp(void);

View File

@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "signals.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "signals_GOOS.h"
#include "os_GOOS.h"
extern void runtime·sigtramp(void);

View File

@ -3,8 +3,8 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
void
runtime·dumpregs(Context *r)

View File

@ -3,8 +3,8 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "defs.h"
#include "os.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
extern void *runtime·sigtramp;

Some files were not shown because too many files have changed in this diff Show More