aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-12-16 15:33:58 -0500
committerRuss Cox <rsc@golang.org>2011-12-16 15:33:58 -0500
commit851f30136d79c9bb752ab56d3991bb3180a5aa5b (patch)
treed58e6051bb8e79e4d286c7b2413b25f399d90af9 /src/pkg
parent474d64d26e8eb8d40bbe2d481513a2070d85ee54 (diff)
downloadgo-851f30136d79c9bb752ab56d3991bb3180a5aa5b.tar.xz
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
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/runtime/Makefile94
-rw-r--r--src/pkg/runtime/arch_386.h (renamed from src/pkg/runtime/386/arch.h)0
-rw-r--r--src/pkg/runtime/arch_amd64.h (renamed from src/pkg/runtime/amd64/arch.h)0
-rw-r--r--src/pkg/runtime/arch_arm.h (renamed from src/pkg/runtime/arm/arch.h)0
-rw-r--r--src/pkg/runtime/asm_386.s (renamed from src/pkg/runtime/386/asm.s)2
-rw-r--r--src/pkg/runtime/asm_amd64.s (renamed from src/pkg/runtime/amd64/asm.s)2
-rw-r--r--src/pkg/runtime/asm_arm.s (renamed from src/pkg/runtime/arm/asm.s)2
-rw-r--r--src/pkg/runtime/atomic_386.c (renamed from src/pkg/runtime/386/atomic.c)0
-rw-r--r--src/pkg/runtime/atomic_amd64.c (renamed from src/pkg/runtime/amd64/atomic.c)0
-rw-r--r--src/pkg/runtime/atomic_arm.c (renamed from src/pkg/runtime/arm/atomic.c)0
-rw-r--r--src/pkg/runtime/callback_windows_386.c (renamed from src/pkg/runtime/windows/386/callback.c)4
-rw-r--r--src/pkg/runtime/callback_windows_amd64.c (renamed from src/pkg/runtime/windows/amd64/callback.c)4
-rw-r--r--src/pkg/runtime/cgocall.c2
-rw-r--r--src/pkg/runtime/closure_386.c (renamed from src/pkg/runtime/386/closure.c)0
-rw-r--r--src/pkg/runtime/closure_amd64.c (renamed from src/pkg/runtime/amd64/closure.c)0
-rw-r--r--src/pkg/runtime/closure_arm.c (renamed from src/pkg/runtime/arm/closure.c)0
-rw-r--r--src/pkg/runtime/cpuprof.c2
-rw-r--r--src/pkg/runtime/defs1_linux.go (renamed from src/pkg/runtime/linux/defs1.go)0
-rw-r--r--src/pkg/runtime/defs2_linux.go (renamed from src/pkg/runtime/linux/defs2.go)0
-rw-r--r--src/pkg/runtime/defs_arm_linux.go (renamed from src/pkg/runtime/linux/defs_arm.go)0
-rw-r--r--src/pkg/runtime/defs_darwin.go (renamed from src/pkg/runtime/darwin/defs.go)0
-rw-r--r--src/pkg/runtime/defs_darwin_386.h (renamed from src/pkg/runtime/darwin/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_darwin_amd64.h (renamed from src/pkg/runtime/darwin/amd64/defs.h)0
-rw-r--r--src/pkg/runtime/defs_freebsd.go (renamed from src/pkg/runtime/freebsd/defs.go)0
-rw-r--r--src/pkg/runtime/defs_freebsd_386.h (renamed from src/pkg/runtime/freebsd/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_freebsd_amd64.h (renamed from src/pkg/runtime/freebsd/amd64/defs.h)0
-rw-r--r--src/pkg/runtime/defs_linux.go (renamed from src/pkg/runtime/linux/defs.go)0
-rw-r--r--src/pkg/runtime/defs_linux_386.h (renamed from src/pkg/runtime/linux/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_linux_amd64.h (renamed from src/pkg/runtime/linux/amd64/defs.h)0
-rw-r--r--src/pkg/runtime/defs_linux_arm.h (renamed from src/pkg/runtime/linux/arm/defs.h)0
-rw-r--r--src/pkg/runtime/defs_netbsd.go (renamed from src/pkg/runtime/netbsd/defs.go)0
-rw-r--r--src/pkg/runtime/defs_netbsd_386.h (renamed from src/pkg/runtime/netbsd/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_netbsd_amd64.h (renamed from src/pkg/runtime/netbsd/amd64/defs.h)0
-rw-r--r--src/pkg/runtime/defs_openbsd.go (renamed from src/pkg/runtime/openbsd/defs.go)0
-rw-r--r--src/pkg/runtime/defs_openbsd_386.h (renamed from src/pkg/runtime/openbsd/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_openbsd_amd64.h (renamed from src/pkg/runtime/openbsd/amd64/defs.h)0
-rw-r--r--src/pkg/runtime/defs_plan9_386.h (renamed from src/pkg/runtime/plan9/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_windows.go (renamed from src/pkg/runtime/windows/defs.go)0
-rw-r--r--src/pkg/runtime/defs_windows_386.h (renamed from src/pkg/runtime/windows/386/defs.h)0
-rw-r--r--src/pkg/runtime/defs_windows_amd64.h (renamed from src/pkg/runtime/windows/amd64/defs.h)0
-rw-r--r--src/pkg/runtime/iface.c2
-rw-r--r--src/pkg/runtime/malloc.goc4
-rw-r--r--src/pkg/runtime/mcache.c2
-rw-r--r--src/pkg/runtime/mcentral.c2
-rw-r--r--src/pkg/runtime/mem_darwin.c (renamed from src/pkg/runtime/darwin/mem.c)6
-rw-r--r--src/pkg/runtime/mem_freebsd.c (renamed from src/pkg/runtime/freebsd/mem.c)6
-rw-r--r--src/pkg/runtime/mem_linux.c (renamed from src/pkg/runtime/linux/mem.c)6
-rw-r--r--src/pkg/runtime/mem_netbsd.c (renamed from src/pkg/runtime/openbsd/mem.c)6
-rw-r--r--src/pkg/runtime/mem_openbsd.c (renamed from src/pkg/runtime/netbsd/mem.c)6
-rw-r--r--src/pkg/runtime/mem_plan9.c (renamed from src/pkg/runtime/plan9/mem.c)4
-rw-r--r--src/pkg/runtime/mem_windows.c (renamed from src/pkg/runtime/windows/mem.c)6
-rw-r--r--src/pkg/runtime/memmove_386.s (renamed from src/pkg/runtime/386/memmove.s)0
-rw-r--r--src/pkg/runtime/memmove_amd64.s (renamed from src/pkg/runtime/amd64/memmove.s)0
-rw-r--r--src/pkg/runtime/memmove_arm.s (renamed from src/pkg/runtime/arm/memmove.s)0
-rw-r--r--src/pkg/runtime/memset_arm.s (renamed from src/pkg/runtime/arm/memset.s)0
-rw-r--r--src/pkg/runtime/mfinal.c2
-rw-r--r--src/pkg/runtime/mfixalloc.c2
-rw-r--r--src/pkg/runtime/mgc0.c2
-rw-r--r--src/pkg/runtime/mheap.c2
-rw-r--r--src/pkg/runtime/mprof.goc4
-rw-r--r--src/pkg/runtime/msize.c2
-rw-r--r--src/pkg/runtime/os_darwin.h (renamed from src/pkg/runtime/darwin/os.h)0
-rw-r--r--src/pkg/runtime/os_freebsd.h (renamed from src/pkg/runtime/freebsd/os.h)0
-rw-r--r--src/pkg/runtime/os_linux.h (renamed from src/pkg/runtime/linux/os.h)0
-rw-r--r--src/pkg/runtime/os_netbsd.h (renamed from src/pkg/runtime/netbsd/os.h)0
-rw-r--r--src/pkg/runtime/os_openbsd.h (renamed from src/pkg/runtime/openbsd/os.h)0
-rw-r--r--src/pkg/runtime/os_plan9.h (renamed from src/pkg/runtime/plan9/os.h)0
-rw-r--r--src/pkg/runtime/os_windows.h (renamed from src/pkg/runtime/windows/os.h)0
-rw-r--r--src/pkg/runtime/proc.c6
-rw-r--r--src/pkg/runtime/rt0_darwin_386.s (renamed from src/pkg/runtime/darwin/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_darwin_amd64.s (renamed from src/pkg/runtime/darwin/amd64/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_freebsd_386.s (renamed from src/pkg/runtime/freebsd/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_freebsd_amd64.s (renamed from src/pkg/runtime/freebsd/amd64/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_linux_386.s (renamed from src/pkg/runtime/linux/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_linux_amd64.s (renamed from src/pkg/runtime/linux/amd64/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_linux_arm.s (renamed from src/pkg/runtime/linux/arm/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_netbsd_386.s (renamed from src/pkg/runtime/netbsd/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_netbsd_amd64.s (renamed from src/pkg/runtime/netbsd/amd64/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_openbsd_386.s (renamed from src/pkg/runtime/openbsd/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_openbsd_amd64.s (renamed from src/pkg/runtime/openbsd/amd64/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_plan9_386.s (renamed from src/pkg/runtime/plan9/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_windows_386.s (renamed from src/pkg/runtime/windows/386/rt0.s)0
-rw-r--r--src/pkg/runtime/rt0_windows_amd64.s (renamed from src/pkg/runtime/windows/amd64/rt0.s)2
-rw-r--r--src/pkg/runtime/runtime.h4
-rw-r--r--src/pkg/runtime/sema.goc2
-rw-r--r--src/pkg/runtime/signal_darwin_386.c (renamed from src/pkg/runtime/darwin/386/signal.c)6
-rw-r--r--src/pkg/runtime/signal_darwin_amd64.c (renamed from src/pkg/runtime/darwin/amd64/signal.c)6
-rw-r--r--src/pkg/runtime/signal_freebsd_386.c (renamed from src/pkg/runtime/freebsd/386/signal.c)6
-rw-r--r--src/pkg/runtime/signal_freebsd_amd64.c (renamed from src/pkg/runtime/freebsd/amd64/signal.c)6
-rw-r--r--src/pkg/runtime/signal_linux_386.c (renamed from src/pkg/runtime/linux/386/signal.c)6
-rw-r--r--src/pkg/runtime/signal_linux_amd64.c (renamed from src/pkg/runtime/linux/amd64/signal.c)6
-rw-r--r--src/pkg/runtime/signal_linux_arm.c (renamed from src/pkg/runtime/linux/arm/signal.c)6
-rw-r--r--src/pkg/runtime/signal_netbsd_386.c (renamed from src/pkg/runtime/openbsd/386/signal.c)6
-rw-r--r--src/pkg/runtime/signal_netbsd_amd64.c (renamed from src/pkg/runtime/netbsd/amd64/signal.c)6
-rw-r--r--src/pkg/runtime/signal_openbsd_386.c (renamed from src/pkg/runtime/netbsd/386/signal.c)6
-rw-r--r--src/pkg/runtime/signal_openbsd_amd64.c (renamed from src/pkg/runtime/openbsd/amd64/signal.c)6
-rw-r--r--src/pkg/runtime/signal_plan9_386.c (renamed from src/pkg/runtime/plan9/386/signal.c)0
-rw-r--r--src/pkg/runtime/signal_windows_386.c (renamed from src/pkg/runtime/windows/386/signal.c)4
-rw-r--r--src/pkg/runtime/signal_windows_amd64.c (renamed from src/pkg/runtime/windows/amd64/signal.c)4
-rw-r--r--src/pkg/runtime/signals_darwin.h (renamed from src/pkg/runtime/darwin/signals.h)0
-rw-r--r--src/pkg/runtime/signals_freebsd.h (renamed from src/pkg/runtime/freebsd/signals.h)0
-rw-r--r--src/pkg/runtime/signals_linux.h (renamed from src/pkg/runtime/linux/signals.h)0
-rw-r--r--src/pkg/runtime/signals_netbsd.h (renamed from src/pkg/runtime/netbsd/signals.h)0
-rw-r--r--src/pkg/runtime/signals_openbsd.h (renamed from src/pkg/runtime/openbsd/signals.h)0
-rw-r--r--src/pkg/runtime/signals_plan9.h (renamed from src/pkg/runtime/plan9/signals.h)0
-rw-r--r--src/pkg/runtime/signals_windows.h (renamed from src/pkg/runtime/windows/signals.h)0
-rw-r--r--src/pkg/runtime/sigqueue.goc2
-rw-r--r--src/pkg/runtime/slice.c2
-rw-r--r--src/pkg/runtime/softfloat_arm.c (renamed from src/pkg/runtime/arm/softfloat.c)0
-rw-r--r--src/pkg/runtime/stack.h2
-rw-r--r--src/pkg/runtime/string.goc2
-rw-r--r--src/pkg/runtime/symtab.c6
-rw-r--r--src/pkg/runtime/sys_darwin_386.s (renamed from src/pkg/runtime/darwin/386/sys.s)2
-rw-r--r--src/pkg/runtime/sys_darwin_amd64.s (renamed from src/pkg/runtime/darwin/amd64/sys.s)2
-rw-r--r--src/pkg/runtime/sys_freebsd_386.s (renamed from src/pkg/runtime/freebsd/386/sys.s)2
-rw-r--r--src/pkg/runtime/sys_freebsd_amd64.s (renamed from src/pkg/runtime/freebsd/amd64/sys.s)2
-rw-r--r--src/pkg/runtime/sys_linux_386.s (renamed from src/pkg/runtime/linux/386/sys.s)2
-rw-r--r--src/pkg/runtime/sys_linux_amd64.s (renamed from src/pkg/runtime/linux/amd64/sys.s)2
-rw-r--r--src/pkg/runtime/sys_linux_arm.s (renamed from src/pkg/runtime/linux/arm/sys.s)2
-rw-r--r--src/pkg/runtime/sys_netbsd_386.s (renamed from src/pkg/runtime/netbsd/386/sys.s)2
-rw-r--r--src/pkg/runtime/sys_netbsd_amd64.s (renamed from src/pkg/runtime/netbsd/amd64/sys.s)2
-rw-r--r--src/pkg/runtime/sys_openbsd_386.s (renamed from src/pkg/runtime/openbsd/386/sys.s)2
-rw-r--r--src/pkg/runtime/sys_openbsd_amd64.s (renamed from src/pkg/runtime/openbsd/amd64/sys.s)2
-rw-r--r--src/pkg/runtime/sys_plan9_386.s (renamed from src/pkg/runtime/plan9/386/sys.s)4
-rw-r--r--src/pkg/runtime/sys_windows_386.s (renamed from src/pkg/runtime/windows/386/sys.s)2
-rw-r--r--src/pkg/runtime/sys_windows_amd64.s (renamed from src/pkg/runtime/windows/amd64/sys.s)2
-rw-r--r--src/pkg/runtime/syscall_windows.goc (renamed from src/pkg/runtime/windows/syscall.goc)2
-rw-r--r--src/pkg/runtime/thread_darwin.c (renamed from src/pkg/runtime/darwin/thread.c)4
-rw-r--r--src/pkg/runtime/thread_freebsd.c (renamed from src/pkg/runtime/freebsd/thread.c)4
-rw-r--r--src/pkg/runtime/thread_linux.c (renamed from src/pkg/runtime/linux/thread.c)4
-rw-r--r--src/pkg/runtime/thread_netbsd.c (renamed from src/pkg/runtime/netbsd/thread.c)4
-rw-r--r--src/pkg/runtime/thread_openbsd.c (renamed from src/pkg/runtime/openbsd/thread.c)4
-rw-r--r--src/pkg/runtime/thread_plan9.c (renamed from src/pkg/runtime/plan9/thread.c)4
-rw-r--r--src/pkg/runtime/thread_windows.c (renamed from src/pkg/runtime/windows/thread.c)4
-rw-r--r--src/pkg/runtime/time.goc6
-rw-r--r--src/pkg/runtime/traceback_amd64.c (renamed from src/pkg/runtime/amd64/traceback.c)2
-rw-r--r--src/pkg/runtime/traceback_arm.c (renamed from src/pkg/runtime/arm/traceback.c)2
-rw-r--r--src/pkg/runtime/vlop_386.s (renamed from src/pkg/runtime/386/vlop.s)0
-rw-r--r--src/pkg/runtime/vlop_arm.s (renamed from src/pkg/runtime/arm/vlop.s)0
-rw-r--r--src/pkg/runtime/vlrt_386.c (renamed from src/pkg/runtime/386/vlrt.c)0
-rw-r--r--src/pkg/runtime/vlrt_arm.c (renamed from src/pkg/runtime/arm/vlrt.c)0
141 files changed, 172 insertions, 176 deletions
diff --git a/src/pkg/runtime/Makefile b/src/pkg/runtime/Makefile
index c390040c45..9fb3a2bbe7 100644
--- a/src/pkg/runtime/Makefile
+++ b/src/pkg/runtime/Makefile
@@ -4,16 +4,10 @@
include ../../Make.inc
-TARG=runtime
-
-# Set SIZE to 32 or 64.
-SIZE_386=32
-SIZE_amd64=64
-SIZE_arm=32
-SIZE=$(SIZE_$(GOARCH))
+# Go tool will do this for package runtime.
+CFLAGS+=-DGOOS_$(GOOS) -DGOARCH_$(GOARCH)
-CFLAGS_windows=-D__WINDOWS__
-CFLAGS=-I$(GOOS) -I$(GOARCH) -I$(GOOS)/$(GOARCH) -FVw $(CFLAGS_$(GOARCH)) $(CFLAGS_$(GOOS))
+TARG=runtime
GOFILES=\
debug.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 $^ $@
diff --git a/src/pkg/runtime/386/arch.h b/src/pkg/runtime/arch_386.h
index a0798f99e9..a0798f99e9 100644
--- a/src/pkg/runtime/386/arch.h
+++ b/src/pkg/runtime/arch_386.h
diff --git a/src/pkg/runtime/amd64/arch.h b/src/pkg/runtime/arch_amd64.h
index dd1cfc18d1..dd1cfc18d1 100644
--- a/src/pkg/runtime/amd64/arch.h
+++ b/src/pkg/runtime/arch_amd64.h
diff --git a/src/pkg/runtime/arm/arch.h b/src/pkg/runtime/arch_arm.h
index c1a7a0f379..c1a7a0f379 100644
--- a/src/pkg/runtime/arm/arch.h
+++ b/src/pkg/runtime/arch_arm.h
diff --git a/src/pkg/runtime/386/asm.s b/src/pkg/runtime/asm_386.s
index 04d4e214c3..c39f365d59 100644
--- a/src/pkg/runtime/386/asm.s
+++ b/src/pkg/runtime/asm_386.s
@@ -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.
diff --git a/src/pkg/runtime/amd64/asm.s b/src/pkg/runtime/asm_amd64.s
index 18cdefb83d..d91421e9e3 100644
--- a/src/pkg/runtime/amd64/asm.s
+++ b/src/pkg/runtime/asm_amd64.s
@@ -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
diff --git a/src/pkg/runtime/arm/asm.s b/src/pkg/runtime/asm_arm.s
index c03422f10c..533c0744d7 100644
--- a/src/pkg/runtime/arm/asm.s
+++ b/src/pkg/runtime/asm_arm.s
@@ -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
diff --git a/src/pkg/runtime/386/atomic.c b/src/pkg/runtime/atomic_386.c
index a4f2a114fc..a4f2a114fc 100644
--- a/src/pkg/runtime/386/atomic.c
+++ b/src/pkg/runtime/atomic_386.c
diff --git a/src/pkg/runtime/amd64/atomic.c b/src/pkg/runtime/atomic_amd64.c
index a4f2a114fc..a4f2a114fc 100644
--- a/src/pkg/runtime/amd64/atomic.c
+++ b/src/pkg/runtime/atomic_amd64.c
diff --git a/src/pkg/runtime/arm/atomic.c b/src/pkg/runtime/atomic_arm.c
index 52e4059ae2..52e4059ae2 100644
--- a/src/pkg/runtime/arm/atomic.c
+++ b/src/pkg/runtime/atomic_arm.c
diff --git a/src/pkg/runtime/windows/386/callback.c b/src/pkg/runtime/callback_windows_386.c
index 11b3d294d9..fcd292fbcd 100644
--- a/src/pkg/runtime/windows/386/callback.c
+++ b/src/pkg/runtime/callback_windows_386.c
@@ -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;
diff --git a/src/pkg/runtime/windows/amd64/callback.c b/src/pkg/runtime/callback_windows_amd64.c
index f6fde4fb88..99d7cb9e38 100644
--- a/src/pkg/runtime/windows/amd64/callback.c
+++ b/src/pkg/runtime/callback_windows_amd64.c
@@ -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;
diff --git a/src/pkg/runtime/cgocall.c b/src/pkg/runtime/cgocall.c
index 4fdb912fa9..b6f23302e4 100644
--- a/src/pkg/runtime/cgocall.c
+++ b/src/pkg/runtime/cgocall.c
@@ -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"
diff --git a/src/pkg/runtime/386/closure.c b/src/pkg/runtime/closure_386.c
index b4d8677114..b4d8677114 100644
--- a/src/pkg/runtime/386/closure.c
+++ b/src/pkg/runtime/closure_386.c
diff --git a/src/pkg/runtime/amd64/closure.c b/src/pkg/runtime/closure_amd64.c
index 481b4a8882..481b4a8882 100644
--- a/src/pkg/runtime/amd64/closure.c
+++ b/src/pkg/runtime/closure_amd64.c
diff --git a/src/pkg/runtime/arm/closure.c b/src/pkg/runtime/closure_arm.c
index 119e91b611..119e91b611 100644
--- a/src/pkg/runtime/arm/closure.c
+++ b/src/pkg/runtime/closure_arm.c
diff --git a/src/pkg/runtime/cpuprof.c b/src/pkg/runtime/cpuprof.c
index b7cf134384..05fa0cf61a 100644
--- a/src/pkg/runtime/cpuprof.c
+++ b/src/pkg/runtime/cpuprof.c
@@ -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
diff --git a/src/pkg/runtime/linux/defs1.go b/src/pkg/runtime/defs1_linux.go
index 6d84e84d76..6d84e84d76 100644
--- a/src/pkg/runtime/linux/defs1.go
+++ b/src/pkg/runtime/defs1_linux.go
diff --git a/src/pkg/runtime/linux/defs2.go b/src/pkg/runtime/defs2_linux.go
index 1fafb7bfc1..1fafb7bfc1 100644
--- a/src/pkg/runtime/linux/defs2.go
+++ b/src/pkg/runtime/defs2_linux.go
diff --git a/src/pkg/runtime/linux/defs_arm.go b/src/pkg/runtime/defs_arm_linux.go
index 35f74e8dba..35f74e8dba 100644
--- a/src/pkg/runtime/linux/defs_arm.go
+++ b/src/pkg/runtime/defs_arm_linux.go
diff --git a/src/pkg/runtime/darwin/defs.go b/src/pkg/runtime/defs_darwin.go
index 6cd988def2..6cd988def2 100644
--- a/src/pkg/runtime/darwin/defs.go
+++ b/src/pkg/runtime/defs_darwin.go
diff --git a/src/pkg/runtime/darwin/386/defs.h b/src/pkg/runtime/defs_darwin_386.h
index 6d1863ce20..6d1863ce20 100644
--- a/src/pkg/runtime/darwin/386/defs.h
+++ b/src/pkg/runtime/defs_darwin_386.h
diff --git a/src/pkg/runtime/darwin/amd64/defs.h b/src/pkg/runtime/defs_darwin_amd64.h
index a8493e4a44..a8493e4a44 100644
--- a/src/pkg/runtime/darwin/amd64/defs.h
+++ b/src/pkg/runtime/defs_darwin_amd64.h
diff --git a/src/pkg/runtime/freebsd/defs.go b/src/pkg/runtime/defs_freebsd.go
index ee80bb2855..ee80bb2855 100644
--- a/src/pkg/runtime/freebsd/defs.go
+++ b/src/pkg/runtime/defs_freebsd.go
diff --git a/src/pkg/runtime/freebsd/386/defs.h b/src/pkg/runtime/defs_freebsd_386.h
index 29fcb8b576..29fcb8b576 100644
--- a/src/pkg/runtime/freebsd/386/defs.h
+++ b/src/pkg/runtime/defs_freebsd_386.h
diff --git a/src/pkg/runtime/freebsd/amd64/defs.h b/src/pkg/runtime/defs_freebsd_amd64.h
index 8a222dca4f..8a222dca4f 100644
--- a/src/pkg/runtime/freebsd/amd64/defs.h
+++ b/src/pkg/runtime/defs_freebsd_amd64.h
diff --git a/src/pkg/runtime/linux/defs.go b/src/pkg/runtime/defs_linux.go
index bbaab2d33e..bbaab2d33e 100644
--- a/src/pkg/runtime/linux/defs.go
+++ b/src/pkg/runtime/defs_linux.go
diff --git a/src/pkg/runtime/linux/386/defs.h b/src/pkg/runtime/defs_linux_386.h
index 02760f987b..02760f987b 100644
--- a/src/pkg/runtime/linux/386/defs.h
+++ b/src/pkg/runtime/defs_linux_386.h
diff --git a/src/pkg/runtime/linux/amd64/defs.h b/src/pkg/runtime/defs_linux_amd64.h
index bf5f79b0e4..bf5f79b0e4 100644
--- a/src/pkg/runtime/linux/amd64/defs.h
+++ b/src/pkg/runtime/defs_linux_amd64.h
diff --git a/src/pkg/runtime/linux/arm/defs.h b/src/pkg/runtime/defs_linux_arm.h
index da97a84339..da97a84339 100644
--- a/src/pkg/runtime/linux/arm/defs.h
+++ b/src/pkg/runtime/defs_linux_arm.h
diff --git a/src/pkg/runtime/netbsd/defs.go b/src/pkg/runtime/defs_netbsd.go
index 4fb3a04634..4fb3a04634 100644
--- a/src/pkg/runtime/netbsd/defs.go
+++ b/src/pkg/runtime/defs_netbsd.go
diff --git a/src/pkg/runtime/netbsd/386/defs.h b/src/pkg/runtime/defs_netbsd_386.h
index aff87fb3b1..aff87fb3b1 100644
--- a/src/pkg/runtime/netbsd/386/defs.h
+++ b/src/pkg/runtime/defs_netbsd_386.h
diff --git a/src/pkg/runtime/netbsd/amd64/defs.h b/src/pkg/runtime/defs_netbsd_amd64.h
index 27bf4b9d65..27bf4b9d65 100644
--- a/src/pkg/runtime/netbsd/amd64/defs.h
+++ b/src/pkg/runtime/defs_netbsd_amd64.h
diff --git a/src/pkg/runtime/openbsd/defs.go b/src/pkg/runtime/defs_openbsd.go
index 4fb3a04634..4fb3a04634 100644
--- a/src/pkg/runtime/openbsd/defs.go
+++ b/src/pkg/runtime/defs_openbsd.go
diff --git a/src/pkg/runtime/openbsd/386/defs.h b/src/pkg/runtime/defs_openbsd_386.h
index aff87fb3b1..aff87fb3b1 100644
--- a/src/pkg/runtime/openbsd/386/defs.h
+++ b/src/pkg/runtime/defs_openbsd_386.h
diff --git a/src/pkg/runtime/openbsd/amd64/defs.h b/src/pkg/runtime/defs_openbsd_amd64.h
index 27bf4b9d65..27bf4b9d65 100644
--- a/src/pkg/runtime/openbsd/amd64/defs.h
+++ b/src/pkg/runtime/defs_openbsd_amd64.h
diff --git a/src/pkg/runtime/plan9/386/defs.h b/src/pkg/runtime/defs_plan9_386.h
index 58fd9d94de..58fd9d94de 100644
--- a/src/pkg/runtime/plan9/386/defs.h
+++ b/src/pkg/runtime/defs_plan9_386.h
diff --git a/src/pkg/runtime/windows/defs.go b/src/pkg/runtime/defs_windows.go
index e23e4207de..e23e4207de 100644
--- a/src/pkg/runtime/windows/defs.go
+++ b/src/pkg/runtime/defs_windows.go
diff --git a/src/pkg/runtime/windows/386/defs.h b/src/pkg/runtime/defs_windows_386.h
index e64a82fafe..e64a82fafe 100644
--- a/src/pkg/runtime/windows/386/defs.h
+++ b/src/pkg/runtime/defs_windows_386.h
diff --git a/src/pkg/runtime/windows/amd64/defs.h b/src/pkg/runtime/defs_windows_amd64.h
index da4c19d90b..da4c19d90b 100644
--- a/src/pkg/runtime/windows/amd64/defs.h
+++ b/src/pkg/runtime/defs_windows_amd64.h
diff --git a/src/pkg/runtime/iface.c b/src/pkg/runtime/iface.c
index c9d020fbeb..9f709355a8 100644
--- a/src/pkg/runtime/iface.c
+++ b/src/pkg/runtime/iface.c
@@ -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"
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index 2f6f809127..b71f5e4330 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -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;
diff --git a/src/pkg/runtime/mcache.c b/src/pkg/runtime/mcache.c
index b6e1c507a6..518e00c123 100644
--- a/src/pkg/runtime/mcache.c
+++ b/src/pkg/runtime/mcache.c
@@ -7,7 +7,7 @@
// See malloc.h for an overview.
#include "runtime.h"
-#include "arch.h"
+#include "arch_GOARCH.h"
#include "malloc.h"
void*
diff --git a/src/pkg/runtime/mcentral.c b/src/pkg/runtime/mcentral.c
index 8463d4eb88..ff0c2d11ad 100644
--- a/src/pkg/runtime/mcentral.c
+++ b/src/pkg/runtime/mcentral.c
@@ -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);
diff --git a/src/pkg/runtime/darwin/mem.c b/src/pkg/runtime/mem_darwin.c
index 2fbd7a0c47..3af7af99ae 100644
--- a/src/pkg/runtime/darwin/mem.c
+++ b/src/pkg/runtime/mem_darwin.c
@@ -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*
diff --git a/src/pkg/runtime/freebsd/mem.c b/src/pkg/runtime/mem_freebsd.c
index b69bbdc6ec..d1c22583dc 100644
--- a/src/pkg/runtime/freebsd/mem.c
+++ b/src/pkg/runtime/mem_freebsd.c
@@ -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*
diff --git a/src/pkg/runtime/linux/mem.c b/src/pkg/runtime/mem_linux.c
index 62e4eda2c2..fdf02c2cac 100644
--- a/src/pkg/runtime/linux/mem.c
+++ b/src/pkg/runtime/mem_linux.c
@@ -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
diff --git a/src/pkg/runtime/openbsd/mem.c b/src/pkg/runtime/mem_netbsd.c
index dea5038771..34ff31d908 100644
--- a/src/pkg/runtime/openbsd/mem.c
+++ b/src/pkg/runtime/mem_netbsd.c
@@ -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
diff --git a/src/pkg/runtime/netbsd/mem.c b/src/pkg/runtime/mem_openbsd.c
index dea5038771..34ff31d908 100644
--- a/src/pkg/runtime/netbsd/mem.c
+++ b/src/pkg/runtime/mem_openbsd.c
@@ -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
diff --git a/src/pkg/runtime/plan9/mem.c b/src/pkg/runtime/mem_plan9.c
index af8b9f14e7..15cbc176b6 100644
--- a/src/pkg/runtime/plan9/mem.c
+++ b/src/pkg/runtime/mem_plan9.c
@@ -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 };
diff --git a/src/pkg/runtime/windows/mem.c b/src/pkg/runtime/mem_windows.c
index f95a1a9825..7840daa22c 100644
--- a/src/pkg/runtime/windows/mem.c
+++ b/src/pkg/runtime/mem_windows.c
@@ -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 {
diff --git a/src/pkg/runtime/386/memmove.s b/src/pkg/runtime/memmove_386.s
index 203a8187c0..203a8187c0 100644
--- a/src/pkg/runtime/386/memmove.s
+++ b/src/pkg/runtime/memmove_386.s
diff --git a/src/pkg/runtime/amd64/memmove.s b/src/pkg/runtime/memmove_amd64.s
index e78be81455..e78be81455 100644
--- a/src/pkg/runtime/amd64/memmove.s
+++ b/src/pkg/runtime/memmove_amd64.s
diff --git a/src/pkg/runtime/arm/memmove.s b/src/pkg/runtime/memmove_arm.s
index 5c0e574042..5c0e574042 100644
--- a/src/pkg/runtime/arm/memmove.s
+++ b/src/pkg/runtime/memmove_arm.s
diff --git a/src/pkg/runtime/arm/memset.s b/src/pkg/runtime/memset_arm.s
index 974b8da7a9..974b8da7a9 100644
--- a/src/pkg/runtime/arm/memset.s
+++ b/src/pkg/runtime/memset_arm.s
diff --git a/src/pkg/runtime/mfinal.c b/src/pkg/runtime/mfinal.c
index efb42e1fbd..c6f2b54219 100644
--- a/src/pkg/runtime/mfinal.c
+++ b/src/pkg/runtime/mfinal.c
@@ -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 };
diff --git a/src/pkg/runtime/mfixalloc.c b/src/pkg/runtime/mfixalloc.c
index 497b5bf132..c916d588fd 100644
--- a/src/pkg/runtime/mfixalloc.c
+++ b/src/pkg/runtime/mfixalloc.c
@@ -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,
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c
index 89bad668fe..b2f22866de 100644
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -5,7 +5,7 @@
// Garbage collector.
#include "runtime.h"
-#include "arch.h"
+#include "arch_GOARCH.h"
#include "malloc.h"
#include "stack.h"
diff --git a/src/pkg/runtime/mheap.c b/src/pkg/runtime/mheap.c
index ed2b248de6..d75c18d828 100644
--- a/src/pkg/runtime/mheap.c
+++ b/src/pkg/runtime/mheap.c
@@ -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);
diff --git a/src/pkg/runtime/mprof.goc b/src/pkg/runtime/mprof.goc
index 57923b846c..b297d41389 100644
--- a/src/pkg/runtime/mprof.goc
+++ b/src/pkg/runtime/mprof.goc
@@ -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.
diff --git a/src/pkg/runtime/msize.c b/src/pkg/runtime/msize.c
index 5e4735a744..e6cfcdb02d 100644
--- a/src/pkg/runtime/msize.c
+++ b/src/pkg/runtime/msize.c
@@ -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];
diff --git a/src/pkg/runtime/darwin/os.h b/src/pkg/runtime/os_darwin.h
index 3e96071ba3..3e96071ba3 100644
--- a/src/pkg/runtime/darwin/os.h
+++ b/src/pkg/runtime/os_darwin.h
diff --git a/src/pkg/runtime/freebsd/os.h b/src/pkg/runtime/os_freebsd.h
index 007856c6bc..007856c6bc 100644
--- a/src/pkg/runtime/freebsd/os.h
+++ b/src/pkg/runtime/os_freebsd.h
diff --git a/src/pkg/runtime/linux/os.h b/src/pkg/runtime/os_linux.h
index 0bb8d03392..0bb8d03392 100644
--- a/src/pkg/runtime/linux/os.h
+++ b/src/pkg/runtime/os_linux.h
diff --git a/src/pkg/runtime/netbsd/os.h b/src/pkg/runtime/os_netbsd.h
index cf35402cac..cf35402cac 100644
--- a/src/pkg/runtime/netbsd/os.h
+++ b/src/pkg/runtime/os_netbsd.h
diff --git a/src/pkg/runtime/openbsd/os.h b/src/pkg/runtime/os_openbsd.h
index cf35402cac..cf35402cac 100644
--- a/src/pkg/runtime/openbsd/os.h
+++ b/src/pkg/runtime/os_openbsd.h
diff --git a/src/pkg/runtime/plan9/os.h b/src/pkg/runtime/os_plan9.h
index b7b8383494..b7b8383494 100644
--- a/src/pkg/runtime/plan9/os.h
+++ b/src/pkg/runtime/os_plan9.h
diff --git a/src/pkg/runtime/windows/os.h b/src/pkg/runtime/os_windows.h
index 2ad95d9585..2ad95d9585 100644
--- a/src/pkg/runtime/windows/os.h
+++ b/src/pkg/runtime/os_windows.h
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 8f4d1ffb4c..cb45a0c299 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -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;
diff --git a/src/pkg/runtime/darwin/386/rt0.s b/src/pkg/runtime/rt0_darwin_386.s
index 30b497f5e7..30b497f5e7 100644
--- a/src/pkg/runtime/darwin/386/rt0.s
+++ b/src/pkg/runtime/rt0_darwin_386.s
diff --git a/src/pkg/runtime/darwin/amd64/rt0.s b/src/pkg/runtime/rt0_darwin_amd64.s
index 4cfab58764..4cfab58764 100644
--- a/src/pkg/runtime/darwin/amd64/rt0.s
+++ b/src/pkg/runtime/rt0_darwin_amd64.s
diff --git a/src/pkg/runtime/freebsd/386/rt0.s b/src/pkg/runtime/rt0_freebsd_386.s
index 3ca981b3a3..3ca981b3a3 100644
--- a/src/pkg/runtime/freebsd/386/rt0.s
+++ b/src/pkg/runtime/rt0_freebsd_386.s
diff --git a/src/pkg/runtime/freebsd/amd64/rt0.s b/src/pkg/runtime/rt0_freebsd_amd64.s
index 5d2eeeefff..5d2eeeefff 100644
--- a/src/pkg/runtime/freebsd/amd64/rt0.s
+++ b/src/pkg/runtime/rt0_freebsd_amd64.s
diff --git a/src/pkg/runtime/linux/386/rt0.s b/src/pkg/runtime/rt0_linux_386.s
index 83149540ec..83149540ec 100644
--- a/src/pkg/runtime/linux/386/rt0.s
+++ b/src/pkg/runtime/rt0_linux_386.s
diff --git a/src/pkg/runtime/linux/amd64/rt0.s b/src/pkg/runtime/rt0_linux_amd64.s
index dac9ae181b..dac9ae181b 100644
--- a/src/pkg/runtime/linux/amd64/rt0.s
+++ b/src/pkg/runtime/rt0_linux_amd64.s
diff --git a/src/pkg/runtime/linux/arm/rt0.s b/src/pkg/runtime/rt0_linux_arm.s
index 8838b48916..8838b48916 100644
--- a/src/pkg/runtime/linux/arm/rt0.s
+++ b/src/pkg/runtime/rt0_linux_arm.s
diff --git a/src/pkg/runtime/netbsd/386/rt0.s b/src/pkg/runtime/rt0_netbsd_386.s
index 829e4133b8..829e4133b8 100644
--- a/src/pkg/runtime/netbsd/386/rt0.s
+++ b/src/pkg/runtime/rt0_netbsd_386.s
diff --git a/src/pkg/runtime/netbsd/amd64/rt0.s b/src/pkg/runtime/rt0_netbsd_amd64.s
index 85482b98db..85482b98db 100644
--- a/src/pkg/runtime/netbsd/amd64/rt0.s
+++ b/src/pkg/runtime/rt0_netbsd_amd64.s
diff --git a/src/pkg/runtime/openbsd/386/rt0.s b/src/pkg/runtime/rt0_openbsd_386.s
index e7e0da78f2..e7e0da78f2 100644
--- a/src/pkg/runtime/openbsd/386/rt0.s
+++ b/src/pkg/runtime/rt0_openbsd_386.s
diff --git a/src/pkg/runtime/openbsd/amd64/rt0.s b/src/pkg/runtime/rt0_openbsd_amd64.s
index e7fce59696..e7fce59696 100644
--- a/src/pkg/runtime/openbsd/amd64/rt0.s
+++ b/src/pkg/runtime/rt0_openbsd_amd64.s
diff --git a/src/pkg/runtime/plan9/386/rt0.s b/src/pkg/runtime/rt0_plan9_386.s
index b56c8b325d..b56c8b325d 100644
--- a/src/pkg/runtime/plan9/386/rt0.s
+++ b/src/pkg/runtime/rt0_plan9_386.s
diff --git a/src/pkg/runtime/windows/386/rt0.s b/src/pkg/runtime/rt0_windows_386.s
index 3b023de2f6..3b023de2f6 100644
--- a/src/pkg/runtime/windows/386/rt0.s
+++ b/src/pkg/runtime/rt0_windows_386.s
diff --git a/src/pkg/runtime/windows/amd64/rt0.s b/src/pkg/runtime/rt0_windows_amd64.s
index 35978bc746..5dc6b6e51b 100644
--- a/src/pkg/runtime/windows/amd64/rt0.s
+++ b/src/pkg/runtime/rt0_windows_amd64.s
@@ -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
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index 3bcb0cd008..7ab7a3fdd6 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -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
};
diff --git a/src/pkg/runtime/sema.goc b/src/pkg/runtime/sema.goc
index 9f3f4a2b39..67c90350b6 100644
--- a/src/pkg/runtime/sema.goc
+++ b/src/pkg/runtime/sema.goc
@@ -19,7 +19,7 @@
package runtime
#include "runtime.h"
-#include "arch.h"
+#include "arch_GOARCH.h"
typedef struct Sema Sema;
struct Sema
diff --git a/src/pkg/runtime/darwin/386/signal.c b/src/pkg/runtime/signal_darwin_386.c
index 95c48b2583..c1cab2ccaa 100644
--- a/src/pkg/runtime/darwin/386/signal.c
+++ b/src/pkg/runtime/signal_darwin_386.c
@@ -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)
diff --git a/src/pkg/runtime/darwin/amd64/signal.c b/src/pkg/runtime/signal_darwin_amd64.c
index c0ef89fc60..fd75e78454 100644
--- a/src/pkg/runtime/darwin/amd64/signal.c
+++ b/src/pkg/runtime/signal_darwin_amd64.c
@@ -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)
diff --git a/src/pkg/runtime/freebsd/386/signal.c b/src/pkg/runtime/signal_freebsd_386.c
index 2fe7ecd707..ff4aaabdb5 100644
--- a/src/pkg/runtime/freebsd/386/signal.c
+++ b/src/pkg/runtime/signal_freebsd_386.c
@@ -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);
diff --git a/src/pkg/runtime/freebsd/amd64/signal.c b/src/pkg/runtime/signal_freebsd_amd64.c
index 8015e366e6..2683f4fd09 100644
--- a/src/pkg/runtime/freebsd/amd64/signal.c
+++ b/src/pkg/runtime/signal_freebsd_amd64.c
@@ -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);
diff --git a/src/pkg/runtime/linux/386/signal.c b/src/pkg/runtime/signal_linux_386.c
index 4045b2efc3..4f3abcebb3 100644
--- a/src/pkg/runtime/linux/386/signal.c
+++ b/src/pkg/runtime/signal_linux_386.c
@@ -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)
diff --git a/src/pkg/runtime/linux/amd64/signal.c b/src/pkg/runtime/signal_linux_amd64.c
index ee90271ed2..937d5c3478 100644
--- a/src/pkg/runtime/linux/amd64/signal.c
+++ b/src/pkg/runtime/signal_linux_amd64.c
@@ -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)
diff --git a/src/pkg/runtime/linux/arm/signal.c b/src/pkg/runtime/signal_linux_arm.c
index 88a84d1120..b32ec7a226 100644
--- a/src/pkg/runtime/linux/arm/signal.c
+++ b/src/pkg/runtime/signal_linux_arm.c
@@ -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)
diff --git a/src/pkg/runtime/openbsd/386/signal.c b/src/pkg/runtime/signal_netbsd_386.c
index 8b0d4ac616..74fa1d490b 100644
--- a/src/pkg/runtime/openbsd/386/signal.c
+++ b/src/pkg/runtime/signal_netbsd_386.c
@@ -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);
diff --git a/src/pkg/runtime/netbsd/amd64/signal.c b/src/pkg/runtime/signal_netbsd_amd64.c
index 01bc76d207..6c69fa7339 100644
--- a/src/pkg/runtime/netbsd/amd64/signal.c
+++ b/src/pkg/runtime/signal_netbsd_amd64.c
@@ -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);
diff --git a/src/pkg/runtime/netbsd/386/signal.c b/src/pkg/runtime/signal_openbsd_386.c
index 8b0d4ac616..74fa1d490b 100644
--- a/src/pkg/runtime/netbsd/386/signal.c
+++ b/src/pkg/runtime/signal_openbsd_386.c
@@ -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);
diff --git a/src/pkg/runtime/openbsd/amd64/signal.c b/src/pkg/runtime/signal_openbsd_amd64.c
index 01bc76d207..6c69fa7339 100644
--- a/src/pkg/runtime/openbsd/amd64/signal.c
+++ b/src/pkg/runtime/signal_openbsd_amd64.c
@@ -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);
diff --git a/src/pkg/runtime/plan9/386/signal.c b/src/pkg/runtime/signal_plan9_386.c
index c0b759c713..c0b759c713 100644
--- a/src/pkg/runtime/plan9/386/signal.c
+++ b/src/pkg/runtime/signal_plan9_386.c
diff --git a/src/pkg/runtime/windows/386/signal.c b/src/pkg/runtime/signal_windows_386.c
index 8d049c9f32..48d2a8bff9 100644
--- a/src/pkg/runtime/windows/386/signal.c
+++ b/src/pkg/runtime/signal_windows_386.c
@@ -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)
diff --git a/src/pkg/runtime/windows/amd64/signal.c b/src/pkg/runtime/signal_windows_amd64.c
index 97106c8b84..92cdb8054f 100644
--- a/src/pkg/runtime/windows/amd64/signal.c
+++ b/src/pkg/runtime/signal_windows_amd64.c
@@ -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;
diff --git a/src/pkg/runtime/darwin/signals.h b/src/pkg/runtime/signals_darwin.h
index 035027fadd..035027fadd 100644
--- a/src/pkg/runtime/darwin/signals.h
+++ b/src/pkg/runtime/signals_darwin.h
diff --git a/src/pkg/runtime/freebsd/signals.h b/src/pkg/runtime/signals_freebsd.h
index 63a84671d9..63a84671d9 100644
--- a/src/pkg/runtime/freebsd/signals.h
+++ b/src/pkg/runtime/signals_freebsd.h
diff --git a/src/pkg/runtime/linux/signals.h b/src/pkg/runtime/signals_linux.h
index 919b80ea29..919b80ea29 100644
--- a/src/pkg/runtime/linux/signals.h
+++ b/src/pkg/runtime/signals_linux.h
diff --git a/src/pkg/runtime/netbsd/signals.h b/src/pkg/runtime/signals_netbsd.h
index 63a84671d9..63a84671d9 100644
--- a/src/pkg/runtime/netbsd/signals.h
+++ b/src/pkg/runtime/signals_netbsd.h
diff --git a/src/pkg/runtime/openbsd/signals.h b/src/pkg/runtime/signals_openbsd.h
index 63a84671d9..63a84671d9 100644
--- a/src/pkg/runtime/openbsd/signals.h
+++ b/src/pkg/runtime/signals_openbsd.h
diff --git a/src/pkg/runtime/plan9/signals.h b/src/pkg/runtime/signals_plan9.h
index 5df7576133..5df7576133 100644
--- a/src/pkg/runtime/plan9/signals.h
+++ b/src/pkg/runtime/signals_plan9.h
diff --git a/src/pkg/runtime/windows/signals.h b/src/pkg/runtime/signals_windows.h
index 6943714b0f..6943714b0f 100644
--- a/src/pkg/runtime/windows/signals.h
+++ b/src/pkg/runtime/signals_windows.h
diff --git a/src/pkg/runtime/sigqueue.goc b/src/pkg/runtime/sigqueue.goc
index 504590a54e..3c12e5caf5 100644
--- a/src/pkg/runtime/sigqueue.goc
+++ b/src/pkg/runtime/sigqueue.goc
@@ -38,7 +38,7 @@
package runtime
#include "runtime.h"
-#include "defs.h"
+#include "defs_GOOS_GOARCH.h"
static struct {
Note;
diff --git a/src/pkg/runtime/slice.c b/src/pkg/runtime/slice.c
index 3bc5cff080..e5726c93b9 100644
--- a/src/pkg/runtime/slice.c
+++ b/src/pkg/runtime/slice.c
@@ -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"
diff --git a/src/pkg/runtime/arm/softfloat.c b/src/pkg/runtime/softfloat_arm.c
index fbe0b04136..fbe0b04136 100644
--- a/src/pkg/runtime/arm/softfloat.c
+++ b/src/pkg/runtime/softfloat_arm.c
diff --git a/src/pkg/runtime/stack.h b/src/pkg/runtime/stack.h
index 483233876a..f56dac120f 100644
--- a/src/pkg/runtime/stack.h
+++ b/src/pkg/runtime/stack.h
@@ -57,7 +57,7 @@ enum {
// to each stack below the usual guard area for OS-specific
// purposes like signal handling. Used on Windows because
// it does not use a separate stack.
-#ifdef __WINDOWS__
+#ifdef GOOS_windows
StackSystem = 512 * sizeof(uintptr),
#else
StackSystem = 0,
diff --git a/src/pkg/runtime/string.goc b/src/pkg/runtime/string.goc
index 0e2dddda34..7e1f8a1e8b 100644
--- a/src/pkg/runtime/string.goc
+++ b/src/pkg/runtime/string.goc
@@ -4,7 +4,7 @@
package runtime
#include "runtime.h"
-#include "arch.h"
+#include "arch_GOARCH.h"
#include "malloc.h"
String runtime·emptystring;
diff --git a/src/pkg/runtime/symtab.c b/src/pkg/runtime/symtab.c
index d0468c6dd4..6cd59136f4 100644
--- a/src/pkg/runtime/symtab.c
+++ b/src/pkg/runtime/symtab.c
@@ -13,9 +13,9 @@
// and figure out exactly what we want.
#include "runtime.h"
-#include "defs.h"
-#include "os.h"
-#include "arch.h"
+#include "defs_GOOS_GOARCH.h"
+#include "os_GOOS.h"
+#include "arch_GOARCH.h"
extern byte pclntab[], epclntab[], symtab[], esymtab[];
diff --git a/src/pkg/runtime/darwin/386/sys.s b/src/pkg/runtime/sys_darwin_386.s
index 426367b9e2..9a513468a0 100644
--- a/src/pkg/runtime/darwin/386/sys.s
+++ b/src/pkg/runtime/sys_darwin_386.s
@@ -6,7 +6,7 @@
// 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.
-#include "386/asm.h"
+#include "asm_386.h"
TEXT runtime·notok(SB),7,$0
MOVL $0xf1, 0xf1
diff --git a/src/pkg/runtime/darwin/amd64/sys.s b/src/pkg/runtime/sys_darwin_amd64.s
index 5a504e3ecf..ac777656c5 100644
--- a/src/pkg/runtime/darwin/amd64/sys.s
+++ b/src/pkg/runtime/sys_darwin_amd64.s
@@ -11,7 +11,7 @@
// The high 8 bits specify the kind of system call: 1=Mach, 2=BSD, 3=Machine-Dependent.
//
-#include "amd64/asm.h"
+#include "asm_amd64.h"
// Exit the entire program (like C exit)
TEXT runtime·exit(SB),7,$0
diff --git a/src/pkg/runtime/freebsd/386/sys.s b/src/pkg/runtime/sys_freebsd_386.s
index 41134ad61f..9833784efc 100644
--- a/src/pkg/runtime/freebsd/386/sys.s
+++ b/src/pkg/runtime/sys_freebsd_386.s
@@ -6,7 +6,7 @@
// /usr/src/sys/kern/syscalls.master for syscall numbers.
//
-#include "386/asm.h"
+#include "asm_386.h"
TEXT runtime·sys_umtx_op(SB),7,$-4
MOVL $454, AX
diff --git a/src/pkg/runtime/freebsd/amd64/sys.s b/src/pkg/runtime/sys_freebsd_amd64.s
index bd63650236..991c33c825 100644
--- a/src/pkg/runtime/freebsd/amd64/sys.s
+++ b/src/pkg/runtime/sys_freebsd_amd64.s
@@ -6,7 +6,7 @@
// /usr/src/sys/kern/syscalls.master for syscall numbers.
//
-#include "amd64/asm.h"
+#include "asm_amd64.h"
TEXT runtime·sys_umtx_op(SB),7,$0
MOVQ 8(SP), DI
diff --git a/src/pkg/runtime/linux/386/sys.s b/src/pkg/runtime/sys_linux_386.s
index d96c022d36..1763143f9e 100644
--- a/src/pkg/runtime/linux/386/sys.s
+++ b/src/pkg/runtime/sys_linux_386.s
@@ -6,7 +6,7 @@
// System calls and other sys.stuff for 386, Linux
//
-#include "386/asm.h"
+#include "asm_386.h"
TEXT runtime·exit(SB),7,$0
MOVL $252, AX // syscall number
diff --git a/src/pkg/runtime/linux/amd64/sys.s b/src/pkg/runtime/sys_linux_amd64.s
index 76bb48c75a..d55518686c 100644
--- a/src/pkg/runtime/linux/amd64/sys.s
+++ b/src/pkg/runtime/sys_linux_amd64.s
@@ -6,7 +6,7 @@
// System calls and other sys.stuff for AMD64, Linux
//
-#include "amd64/asm.h"
+#include "asm_amd64.h"
TEXT runtime·exit(SB),7,$0-8
MOVL 8(SP), DI
diff --git a/src/pkg/runtime/linux/arm/sys.s b/src/pkg/runtime/sys_linux_arm.s
index 14ea337d02..d0b36dedf9 100644
--- a/src/pkg/runtime/linux/arm/sys.s
+++ b/src/pkg/runtime/sys_linux_arm.s
@@ -6,7 +6,7 @@
// System calls and other sys.stuff for arm, Linux
//
-#include "arm/asm.h"
+#include "asm_arm.h"
// OABI
//#define SYS_BASE 0x00900000
diff --git a/src/pkg/runtime/netbsd/386/sys.s b/src/pkg/runtime/sys_netbsd_386.s
index 20ed09a6b5..bcb4fc5e71 100644
--- a/src/pkg/runtime/netbsd/386/sys.s
+++ b/src/pkg/runtime/sys_netbsd_386.s
@@ -6,7 +6,7 @@
// /usr/src/sys/kern/syscalls.master for syscall numbers.
//
-#include "386/asm.h"
+#include "asm_386.h"
// Exit the entire program (like C exit)
TEXT runtime·exit(SB),7,$-4
diff --git a/src/pkg/runtime/netbsd/amd64/sys.s b/src/pkg/runtime/sys_netbsd_amd64.s
index 693b51dff1..20817711fb 100644
--- a/src/pkg/runtime/netbsd/amd64/sys.s
+++ b/src/pkg/runtime/sys_netbsd_amd64.s
@@ -6,7 +6,7 @@
// /usr/src/sys/kern/syscalls.master for syscall numbers.
//
-#include "amd64/asm.h"
+#include "asm_amd64.h"
// int64 rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
TEXT runtime·rfork_thread(SB),7,$0
diff --git a/src/pkg/runtime/openbsd/386/sys.s b/src/pkg/runtime/sys_openbsd_386.s
index 2b1be7ee6b..ae3275c852 100644
--- a/src/pkg/runtime/openbsd/386/sys.s
+++ b/src/pkg/runtime/sys_openbsd_386.s
@@ -6,7 +6,7 @@
// /usr/src/sys/kern/syscalls.master for syscall numbers.
//
-#include "386/asm.h"
+#include "asm_386.h"
// Exit the entire program (like C exit)
TEXT runtime·exit(SB),7,$-4
diff --git a/src/pkg/runtime/openbsd/amd64/sys.s b/src/pkg/runtime/sys_openbsd_amd64.s
index 9c2d403b25..f568ba4312 100644
--- a/src/pkg/runtime/openbsd/amd64/sys.s
+++ b/src/pkg/runtime/sys_openbsd_amd64.s
@@ -6,7 +6,7 @@
// /usr/src/sys/kern/syscalls.master for syscall numbers.
//
-#include "amd64/asm.h"
+#include "asm_amd64.h"
// int64 rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
TEXT runtime·rfork_thread(SB),7,$0
diff --git a/src/pkg/runtime/plan9/386/sys.s b/src/pkg/runtime/sys_plan9_386.s
index 97be276be6..8c773eee9d 100644
--- a/src/pkg/runtime/plan9/386/sys.s
+++ b/src/pkg/runtime/sys_plan9_386.s
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#include "defs.h"
-#include "386/asm.h"
+#include "defs_GOOS_GOARCH.h"
+#include "asm_386.h"
// setldt(int entry, int address, int limit)
TEXT runtime·setldt(SB),7,$0
diff --git a/src/pkg/runtime/windows/386/sys.s b/src/pkg/runtime/sys_windows_386.s
index 69b9b82e82..307b93d5c7 100644
--- a/src/pkg/runtime/windows/386/sys.s
+++ b/src/pkg/runtime/sys_windows_386.s
@@ -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"
// void runtime·asmstdcall(void *c);
TEXT runtime·asmstdcall(SB),7,$0
diff --git a/src/pkg/runtime/windows/amd64/sys.s b/src/pkg/runtime/sys_windows_amd64.s
index a1e36fe132..508759ff8f 100644
--- a/src/pkg/runtime/windows/amd64/sys.s
+++ b/src/pkg/runtime/sys_windows_amd64.s
@@ -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"
// maxargs should be divisible by 2, as Windows stack
// must be kept 16-byte aligned on syscall entry.
diff --git a/src/pkg/runtime/windows/syscall.goc b/src/pkg/runtime/syscall_windows.goc
index d97a6cafd6..781ec908d0 100644
--- a/src/pkg/runtime/windows/syscall.goc
+++ b/src/pkg/runtime/syscall_windows.goc
@@ -4,7 +4,7 @@
package syscall
#include "runtime.h"
-#include "os.h"
+#include "os_GOOS.h"
#include "cgocall.h"
func loadlibrary(filename *uint16) (handle uintptr, err uintptr) {
diff --git a/src/pkg/runtime/darwin/thread.c b/src/pkg/runtime/thread_darwin.c
index 4665408725..12e79afda0 100644
--- a/src/pkg/runtime/darwin/thread.c
+++ b/src/pkg/runtime/thread_darwin.c
@@ -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"
#include "stack.h"
extern SigTab runtime·sigtab[];
diff --git a/src/pkg/runtime/freebsd/thread.c b/src/pkg/runtime/thread_freebsd.c
index 48532f6afc..779782ac96 100644
--- a/src/pkg/runtime/freebsd/thread.c
+++ b/src/pkg/runtime/thread_freebsd.c
@@ -2,8 +2,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"
#include "stack.h"
extern SigTab runtime·sigtab[];
diff --git a/src/pkg/runtime/linux/thread.c b/src/pkg/runtime/thread_linux.c
index 5502bbbcab..d72e9cb435 100644
--- a/src/pkg/runtime/linux/thread.c
+++ b/src/pkg/runtime/thread_linux.c
@@ -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"
#include "stack.h"
extern SigTab runtime·sigtab[];
diff --git a/src/pkg/runtime/netbsd/thread.c b/src/pkg/runtime/thread_netbsd.c
index 3824a4f1b4..0aba02720e 100644
--- a/src/pkg/runtime/netbsd/thread.c
+++ b/src/pkg/runtime/thread_netbsd.c
@@ -2,8 +2,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"
#include "stack.h"
enum
diff --git a/src/pkg/runtime/openbsd/thread.c b/src/pkg/runtime/thread_openbsd.c
index 55ca64b80b..e1cd5bf2e4 100644
--- a/src/pkg/runtime/openbsd/thread.c
+++ b/src/pkg/runtime/thread_openbsd.c
@@ -2,8 +2,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"
#include "stack.h"
enum
diff --git a/src/pkg/runtime/plan9/thread.c b/src/pkg/runtime/thread_plan9.c
index 07edb717e4..a9b156d028 100644
--- a/src/pkg/runtime/plan9/thread.c
+++ b/src/pkg/runtime/thread_plan9.c
@@ -3,8 +3,8 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
-#include "os.h"
-#include "arch.h"
+#include "os_GOOS.h"
+#include "arch_GOARCH.h"
int8 *goos = "plan9";
diff --git a/src/pkg/runtime/windows/thread.c b/src/pkg/runtime/thread_windows.c
index dc7e06cd33..ad66c93a64 100644
--- a/src/pkg/runtime/windows/thread.c
+++ b/src/pkg/runtime/thread_windows.c
@@ -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"
#pragma dynimport runtime·CloseHandle CloseHandle "kernel32.dll"
#pragma dynimport runtime·CreateEvent CreateEventA "kernel32.dll"
diff --git a/src/pkg/runtime/time.goc b/src/pkg/runtime/time.goc
index 8306e61358..a6b8352470 100644
--- a/src/pkg/runtime/time.goc
+++ b/src/pkg/runtime/time.goc
@@ -7,9 +7,9 @@
package time
#include "runtime.h"
-#include "defs.h"
-#include "os.h"
-#include "arch.h"
+#include "defs_GOOS_GOARCH.h"
+#include "os_GOOS.h"
+#include "arch_GOARCH.h"
#include "malloc.h"
static Timers timers;
diff --git a/src/pkg/runtime/amd64/traceback.c b/src/pkg/runtime/traceback_amd64.c
index fc9021e40e..fedda797c2 100644
--- a/src/pkg/runtime/amd64/traceback.c
+++ b/src/pkg/runtime/traceback_amd64.c
@@ -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"
static uintptr isclosureentry(uintptr);
diff --git a/src/pkg/runtime/arm/traceback.c b/src/pkg/runtime/traceback_arm.c
index 0319cdc9b6..22e0bc3a66 100644
--- a/src/pkg/runtime/arm/traceback.c
+++ b/src/pkg/runtime/traceback_arm.c
@@ -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"
void runtime·deferproc(void);
diff --git a/src/pkg/runtime/386/vlop.s b/src/pkg/runtime/vlop_386.s
index 28f6da82dd..28f6da82dd 100644
--- a/src/pkg/runtime/386/vlop.s
+++ b/src/pkg/runtime/vlop_386.s
diff --git a/src/pkg/runtime/arm/vlop.s b/src/pkg/runtime/vlop_arm.s
index fc679f0eea..fc679f0eea 100644
--- a/src/pkg/runtime/arm/vlop.s
+++ b/src/pkg/runtime/vlop_arm.s
diff --git a/src/pkg/runtime/386/vlrt.c b/src/pkg/runtime/vlrt_386.c
index 1631dbe108..1631dbe108 100644
--- a/src/pkg/runtime/386/vlrt.c
+++ b/src/pkg/runtime/vlrt_386.c
diff --git a/src/pkg/runtime/arm/vlrt.c b/src/pkg/runtime/vlrt_arm.c
index 50f33710b1..50f33710b1 100644
--- a/src/pkg/runtime/arm/vlrt.c
+++ b/src/pkg/runtime/vlrt_arm.c