summaryrefslogtreecommitdiff
path: root/src/runtime/cgo
Commit message (Collapse)AuthorAgeFilesLines
* [dev.cc] [dev.cc] runtime: fix freebsd cgo __progname exportJoel Sing2014-11-121-2/+2
| | | | | | | | | LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/174050043 Committer: Russ Cox <rsc@golang.org>
* [dev.cc] runtime/cgo: add comment about import _ "unsafe"Russ Cox2014-11-126-6/+6
| | | | | | | LGTM=bradfitz, r R=r, bradfitz CC=golang-codereviews https://codereview.appspot.com/167650043
* [dev.cc] runtime/cgo: fix freebsd build?Russ Cox2014-11-111-0/+3
| | | | | | | | Last try and then someone with a FreeBSD has to do it. TBR=r CC=golang-codereviews https://codereview.appspot.com/171590043
* [dev.cc] runtime/cgo: add missing import _ "unsafe" for //go:linknameRuss Cox2014-11-113-0/+6
| | | | | | | | | Will prod freebsd build along. Not claiming it will fix it. TBR=r CC=golang-codereviews https://codereview.appspot.com/171580044
* [dev.cc] runtime/cgo: convert from C to GoRuss Cox2014-11-119-130/+153
| | | | | | | | | | | | | The conversion was done with an automated tool and then modified only as necessary to make it compile and run. [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] LGTM=r R=r CC=austin, dvyukov, golang-codereviews, iant, khr https://codereview.appspot.com/168500043
* runtime/cgo: add +build tags to files named for $GOOSRuss Cox2014-11-094-0/+8
| | | | | | | | | | | These are being built into the runtime/cgo for every operating system. It doesn't seem to matter, but restore the Go 1.3 behavior anyway. LGTM=r R=r, dave CC=golang-codereviews https://codereview.appspot.com/171290043
* runtime/cgo: encode BLX directly, fixes one clang build error on armDave Cheney2014-10-221-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue 8348. Trying to work around clang's dodgy support for .arch by reverting to the external assembler didn't work out so well. Minux had a much better solution to encode the instructions we need as .word directives which avoids .arch altogether. I've confirmed with gdb that this form produces the expected machine code Dump of assembler code for function crosscall_arm1: 0x00000000 <+0>: push {r4, r5, r6, r7, r8, r9, r10, r11, r12, lr} 0x00000004 <+4>: mov r4, r0 0x00000008 <+8>: mov r5, r1 0x0000000c <+12>: mov r0, r2 0x00000010 <+16>: blx r5 0x00000014 <+20>: blx r4 0x00000018 <+24>: pop {r4, r5, r6, r7, r8, r9, r10, r11, r12, pc} There is another compilation failure that blocks building Go with clang on arm # ../misc/cgo/test # _/home/dfc/go/misc/cgo/test /tmp/--407b12.s: Assembler messages: /tmp/--407b12.s:59: Error: selected processor does not support ARM mode `blx r0' clang: error: assembler command failed with exit code 1 (use -v to see invocation) FAIL _/home/dfc/go/misc/cgo/test [build failed] I'll open a new issue for that LGTM=iant R=iant, minux CC=golang-codereviews https://codereview.appspot.com/158180047
* os, syscall: add UnsetenvBrad Fitzpatrick2014-10-012-0/+10
| | | | | | | | | | | | | Also address a TODO, making Clearenv pass through to cgo. Based largely on Minux's earlier https://codereview.appspot.com/82040044 Fixes Issue 6423 LGTM=iant, alex.brainman, r, rsc R=rsc, iant, r, alex.brainman CC=golang-codereviews https://codereview.appspot.com/148370043
* runtime: add load_g call in arm callback.Keith Randall2014-09-251-2/+2
| | | | | | | | | Need to restore the g register. Somehow this line vaporized from CL 144130043. Also cgo_topofstack -> _cgo_topofstack, that vaporized also. TBR=rsc CC=golang-codereviews https://codereview.appspot.com/150940044
* cgo: adjust return value location to account for stack copies.Keith Randall2014-09-251-0/+3
| | | | | | | | | | | | | | | | During a cgo call, the stack can be copied. This copy invalidates the pointer that cgo has into the return value area. To fix this problem, pass the address of the location containing the stack top value (which is in the G struct). For cgo functions which return values, read the stktop before and after the cgo call to compute the adjustment necessary to write the return value. Fixes issue 8771 LGTM=iant, rsc R=iant, rsc, khr CC=golang-codereviews https://codereview.appspot.com/144130043
* runtime: more NOPTRRuss Cox2014-09-244-0/+16
| | | | | | | | Fixes (or makes better) various builds. TBR=iant CC=golang-codereviews https://codereview.appspot.com/146280043
* runtime: assume precisestack, copystack, StackCopyAlways, ScanStackByFramesRuss Cox2014-09-0918-158/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit to stack copying for stack growth. We're carrying around a surprising amount of cruft from older schemes. I am confident that precise stack scans and stack copying are here to stay. Delete fallback code for when precise stack info is disabled. Delete fallback code for when copying stacks is disabled. Delete fallback code for when StackCopyAlways is disabled. Delete Stktop chain - there is only one stack segment now. Delete M.moreargp, M.moreargsize, M.moreframesize, M.cret. Delete G.writenbuf (unrelated, just dead). Delete runtime.lessstack, runtime.oldstack. Delete many amd64 morestack variants. Delete initialization of morestack frame/arg sizes (shortens split prologue!). Replace G's stackguard/stackbase/stack0/stacksize/ syscallstack/syscallguard/forkstackguard with simple stack bounds (lo, hi). Update liblink, runtime/cgo for adjustments to G. LGTM=khr R=khr, bradfitz CC=golang-codereviews, iant, r https://codereview.appspot.com/137410043
* liblink, runtime: diagnose and fix C code running on Go stackRuss Cox2014-09-082-33/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL contains compiler+runtime changes that detect C code running on Go (not g0, not gsignal) stacks, and it contains corrections for what it detected. The detection works by changing the C prologue to use a different stack guard word in the G than Go prologue does. On the g0 and gsignal stacks, that stack guard word is set to the usual stack guard value. But on ordinary Go stacks, that stack guard word is set to ^0, which will make any stack split check fail. The C prologue then calls morestackc instead of morestack, and morestackc aborts the program with a message about running C code on a Go stack. This check catches all C code running on the Go stack except NOSPLIT code. The NOSPLIT code is allowed, so the check is complete. Since it is a dynamic check, the code must execute to be caught. But unlike the static checks we've been using in cmd/ld, the dynamic check works with function pointers and other indirect calls. For example it caught sigpanic being pushed onto Go stacks in the signal handlers. Fixes issue 8667. LGTM=khr, iant R=golang-codereviews, khr, iant CC=golang-codereviews, r https://codereview.appspot.com/133700043
* build: move package sources from src/pkg to srcRuss Cox2014-09-0838-0/+2288
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.