aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/cgo
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2013-03-23 03:21:30 +0800
committerShenghou Ma <minux.ma@gmail.com>2013-03-23 03:21:30 +0800
commit092b7cfb08f6bc843050c71f1aae9ffbf4b512a5 (patch)
tree803370f4e13e1488ca270deb4bbc620da6c1a6fc /src/pkg/runtime/cgo
parent81d26e3817524c98e24c5a2a01bc87fbceb9c61b (diff)
downloadgo-092b7cfb08f6bc843050c71f1aae9ffbf4b512a5.tar.xz
runtime/cgo, go/build: re-enable cgo for FreeBSD/ARM.
R=dave, rsc CC=golang-dev https://golang.org/cl/7970043
Diffstat (limited to 'src/pkg/runtime/cgo')
-rw-r--r--src/pkg/runtime/cgo/gcc_freebsd_arm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pkg/runtime/cgo/gcc_freebsd_arm.c b/src/pkg/runtime/cgo/gcc_freebsd_arm.c
index 3bcb0b2701..73c990c28f 100644
--- a/src/pkg/runtime/cgo/gcc_freebsd_arm.c
+++ b/src/pkg/runtime/cgo/gcc_freebsd_arm.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.
+#include <sys/types.h>
+#include <machine/sysarch.h>
#include <pthread.h>
#include <string.h>
#include "libcgo.h"
@@ -22,10 +24,20 @@ void x_cgo_load_gm(void) __attribute__((naked));
void
__aeabi_read_tp(void)
{
- // read @ 0xffff1000
__asm__ __volatile__ (
+#ifdef ARM_TP_ADDRESS
+ // ARM_TP_ADDRESS is (ARM_VECTORS_HIGH + 0x1000) or 0xffff1000
+ // GCC inline asm doesn't provide a way to provide a constant
+ // to "ldr r0, =??" pseudo instruction, so we hardcode the value
+ // and check it with cpp.
+#if ARM_TP_ADDRESS != 0xffff1000
+#error Wrong ARM_TP_ADDRESS!
+#endif
"ldr r0, =0xffff1000\n\t"
"ldr r0, [r0]\n\t"
+#else
+ "mrc p15, 0, r0, c13, c0, 3\n\t"
+#endif
"mov pc, lr\n\t"
);
}