1. make the program go buildable
2. update os.EINVAL and runtime.Cgocalls()
3. wrap mpz_div_2exp() and mpz_mul_2exp to support both
pre-5.0 and post-5.0 gmp (we really have no reason to
restrict ourselves to gmp 5.0+)
R=golang-dev, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/5847061
The test.bash file generates .so file using gcc, builds the executable
using the go tool and then run it with the $LD_LIBRARY_PATH variable
pointing to the directory where the .so file lives.
Fixes#2982.
R=rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/5788043
Does not actually test so files.
««« original CL description
misc/cgo: re-enable testso
Also enabled it for darwin.
R=rsc
CC=golang-dev
https://golang.org/cl/5754063
»»»
R=golang-dev, minux.ma, r, f
CC=golang-dev
https://golang.org/cl/5756075
The last CL forgot the all-important 'backdoor' package.
Cgo-using packages compile .c files with gcc, but we want
to compile this one with 6c, so put it in a non-cgo package.
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5758063
Also delete gotest, since it's messy to fix and slated for deletion anyway.
A couple of things outside src can't be tested any more. "go test" will be
fixed and these tests will be re-enabled. They're noisy for now.
Fixes#284.
R=rsc
CC=golang-dev
https://golang.org/cl/5598049
- use proper Win64 gcc calling convention when
calling initcgo on amd64
- increase g0 stack size to 64K on amd64 to make
it the same as 386
- implement C.sleep
- do not use C.stat, since it is renamed to C._stat by mingw
- use fopen to implement TestErrno, since C.strtol
always succeeds on windows
- skip TestSetEnv on windows, because os.Setenv
sets windows process environment, while C.getenv
inspects internal C runtime variable instead
R=golang-dev, vcc.163, rsc
CC=golang-dev
https://golang.org/cl/5500094
This change doesn't pay attention to structs
so they still cannot be exported, see Issue 2552.
Fixes#2462.
R=dvyukov, rsc, iant
CC=golang-dev
https://golang.org/cl/5487058
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.
No attempt is made to use the new Append functions
even though there are definitely opportunities.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
Fixes crash when cgo consumes more than 8K
of stack and makes a callback.
Fixes#1328.
R=golang-dev, rogpeppe, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5371042
There may be more fine-tuning down the line,
but this CL fixes the most pressing issue at
hand.
Also: gofmt -w src misc
Fixes#1524.
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4975053
Allocate Defer on stack during cgo calls, as suggested
by dvyukov. Also includes some comment corrections.
benchmark old,ns/op new,ns/op
BenchmarkCgoCall 669 330
(Intel Xeon CPU 1.80GHz * 4, Linux 386)
R=dvyukov, rsc
CC=golang-dev
https://golang.org/cl/4910041
When the C API being used includes multiple names for the same
underlying symbol (e.g. multiple #define's for the same variable), then
cgo will generate the same placeholder variables for each name. This
then prevents the code from compiling due to multiple declarations of
the same variable - so change cgo to only create one instance of the
variable for the underlying symbol.
R=rsc
CC=golang-dev
https://golang.org/cl/4826055
The new gotest ignores Test functions outside *_test.go files
(the old shell script allowed them), so replace one clumsy hack
with another.
The root problem is that the package makefiles only know
how to run cgo for source files in the package proper, not
for test files. Making it work for test files is probably more
trouble than it's worth.
R=bradfitz
CC=golang-dev
https://golang.org/cl/4452060
* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).
Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).
The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack. Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler. If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless. Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.
* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.
Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.
The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).
The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc. Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.
Fixes#1560.
R=iant
CC=golang-dev
https://golang.org/cl/4253054
#pragma dynexport is no longer needed for
this use of cgo, since the gcc and gc code are
now linked together into the same binary.
It may still be necessary later.
On the Mac, you cannot use the GOT to resolve
symbols that exist in the current binary, so 6l and 8l
translate the GOT-loading mov instructions into lea
instructions.
On ELF systems, we could use the GOT for those
symbols, but for consistency 6l and 8l apply the
same translation.
The translation is sketchy in the extreme
(depending on the relocation being in a mov
instruction) but it verifies that the instruction
is a mov before rewriting it to lea.
Also makes typedefs global across files.
Fixes#1335.
Fixes#1345.
R=iant, r
CC=golang-dev
https://golang.org/cl/3650042
Clean up an error message and error exit too.
Insert blank line after "DO NOT EDIT" comment
to keep it from being a doc comment.
Fixes#1213.
Fixes#1222.
R=r
CC=golang-dev
https://golang.org/cl/3608042
* Add documentation about array arguments. Fixes issue 1125.
* Do not interpret x, y := z, w as special errno form. Fixes issue 952.
* Fix nested Go calls (brainman). Fixes issue 907.
R=r
CC=golang-dev
https://golang.org/cl/2214044
* remember #defined names, so that C.stdout can refer
to the real name (on OS X) __stdoutp.
* better handling of #defined constant expressions
* allow n, err = C.strtol("asdf", 0, 123) to get errno as os.Error
* write all output files to current directory
* don't require gcc output if there was no input
Fixes#533.
Fixes#709.
Fixes#756.
R=r
CC=dho, golang-dev, iant
https://golang.org/cl/1734047
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
1st set of files.
R=rsc
CC=agl, golang-dev, iant, ken2, r
https://golang.org/cl/180047
This change removes the necessity to have GOBIN in $PATH,
and also doesn't assume that the build is being run from
$GOROOT/src. This is a minimal set of necessary changes
to get Go to build happily from the FreeBSD ports
collection.
R=rsc
CC=golang-dev
https://golang.org/cl/171044
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.
this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.
Fixes#115.
R=rsc, dsymonds1
https://golang.org/cl/157067
cgo/libmach remain unimplemented. However, compilers, runtime,
and packages are 100%. I still need to go through and implement
missing syscalls (at least make sure they're all listed), but
for all shipped functionality, this is done. Ship! ;)
R=rsc, VenkateshSrinivas
https://golang.org/cl/152142
better mach binaries.
cgo working on darwin+linux amd64+386.
eliminated context switches - pi is 30x faster.
add libcgo to build.
on snow leopard:
- non-cgo binaries work; all tests pass.
- cgo binaries work on amd64 but not 386.
R=r
DELTA=2031 (1316 added, 626 deleted, 89 changed)
OCL=35264
CL=35304