build: a round of fixes
TBR=r
CC=golang-dev
https://golang.org/cl/5503052
diff --git a/src/pkg/runtime/Makefile b/src/pkg/runtime/Makefile
index 7bd648d..87c18f0 100644
--- a/src/pkg/runtime/Makefile
+++ b/src/pkg/runtime/Makefile
@@ -137,7 +137,7 @@
clean: clean-local
clean-local:
- rm -f $(AUTOHFILES)
+ rm -f $(AUTOHFILES) runtime_defs.go version*.go
arch_GOARCH.h: arch_$(GOARCH).h
cp $^ $@
diff --git a/src/pkg/runtime/cgo/gcc_setenv.c b/src/pkg/runtime/cgo/gcc_setenv.c
index c911b83..7da4ad9 100644
--- a/src/pkg/runtime/cgo/gcc_setenv.c
+++ b/src/pkg/runtime/cgo/gcc_setenv.c
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build darwin freebsd linux netbsd openbsd
+
#include "libcgo.h"
#include <stdlib.h>
diff --git a/src/pkg/runtime/cgo/trigger.go b/src/pkg/runtime/cgo/trigger.go
index b006d9b..61666ff 100644
--- a/src/pkg/runtime/cgo/trigger.go
+++ b/src/pkg/runtime/cgo/trigger.go
@@ -7,4 +7,14 @@
package cgo
+/*
+
+#cgo darwin LDFLAGS: -lpthread
+#cgo freebsd LDFLAGS: -lpthread
+#cgo linux LDFLAGS: -lpthread
+#cgo netbsd LDFLAGS: -lpthread
+#cgo openbsd LDFLAGS: -lpthread
+#cgo windows LDFLAGS: -lm -lmthreads
+
+*/
import "C"
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index 7ab7a3f..7f1cb59 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -635,7 +635,8 @@
* low level C-called
*/
uint8* runtime·mmap(byte*, uintptr, int32, int32, int32, uint32);
-void runtime·munmap(uint8*, uintptr);
+void runtime·munmap(byte*, uintptr);
+void runtime·madvise(byte*, uintptr, int32);
void runtime·memclr(byte*, uintptr);
void runtime·setcallerpc(void*, void*);
void* runtime·getcallerpc(void*);