- 27 Jun, 2017 3 commits
-
-
On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes This is adapted from change 37845. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/46772 From-SVN: r249713
Ian Lance Taylor committed -
Fixes required now that we #include <linux/ptrace.h> in sysinfo.c. Patch by Andreas Krebbel. Reviewed-on: https://go-review.googlesource.com/46839 From-SVN: r249712
Ian Lance Taylor committed -
Copy all the misc/cgo files from the gc toolchain into libgo/misc. These will be used for testing purposes by later changes to the gotools directory. Reviewed-on: https://go-review.googlesource.com/46721 From-SVN: r249674
Ian Lance Taylor committed
-
- 26 Jun, 2017 2 commits
-
-
It's now defined by mksysinfo.sh. Patch by Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/46712 From-SVN: r249663
Ian Lance Taylor committed -
Avoid https://sourceware.org/bugzilla/show_bug.cgi?id=762. Patch by Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/46711 From-SVN: r249662
Ian Lance Taylor committed
-
- 23 Jun, 2017 5 commits
-
-
When C code calls a Go function, it actually calls a function generated by cgo. That function is written in Go, and, among other things, it calls the real Go function like this: CgocallBack() defer CgocallBackDone() RealGoFunction() The deferred CgocallBackDone function enters syscall mode as we return to C. Typically the C function will then eventually return to Go. However, in the case where the C function is running on a thread created in C, it will not return to Go. For that case we will have allocated an m struct, with an associated g struct, for the duration of the Go code, and when the Go is complete we will return the m and g to a free list. That all works, but we are running in a deferred function, which means that we have been invoked by deferreturn, and deferreturn expects to do a bit of cleanup to record that the defer has been completed. Doing that cleanup while using an m and g that have already been returned to the free list is clearly a bad idea. It was kind of working because deferreturn was holding the g pointer in a local variable, but there were races with some other thread picking up and using the newly freed g. It was also kind of working because of a special check in freedefer; that check is no longer necessary. This patch changes the special case of releasing the m and g to do the defer cleanup in CgocallBackDone itself. This patch also checks for the special case of a panic through CgocallBackDone. In that special case, we don't want to release the m and g. Since we are returning to C code that was not called by Go code, we know that the panic is not going to be caught and we are going to exit the program. So for that special case we keep the m and g structs so that the rest of the panic code can use them. Reviewed-on: https://go-review.googlesource.com/46530 From-SVN: r249611
Ian Lance Taylor committed -
Reviewed-on: https://go-review.googlesource.com/46590 From-SVN: r249609
Ian Lance Taylor committed -
Backport https://golang.org/cl/46511 from gc trunk, as it may fix a bug reported for gccgo running on MIPS (https://groups.google.com/d/msg/golang-dev/sDg-t1_DPw0/-AJmLxgPBQAJ). Reviewed-on: https://go-review.googlesource.com/46571 From-SVN: r249599
Ian Lance Taylor committed -
The kickoff function for g0 can be invoked without a p, for example from mcall(exitsyscall0) in exitsyscall after exitsyscall has cleared the p field. The assignment gp.param = nil will invoke a write barrier. If gp.param is not already nil, this will require a p. Avoid the problem for a specific case that is known to be OK: when the value in gp.param is a *g. Reviewed-on: https://go-review.googlesource.com/46512 From-SVN: r249595
Ian Lance Taylor committed -
When a panic occurs while processing a deferred function that recovered an earlier panic, we shouldn't report the recovered panic in the panic stack trace. Stop doing so by keeping track of the panic that triggered a defer, marking it as aborted if we see the defer again, and discarding aborted panics when a panic is recovered. This is what the gc runtime does. The test for this is TestRecursivePanic in runtime/crash_test.go. We don't run that test yet, but we will soon. Reviewed-on: https://go-review.googlesource.com/46461 From-SVN: r249590
Ian Lance Taylor committed
-
- 22 Jun, 2017 14 commits
-
-
Now that systemstack changes to the g0 stack, this check passes. Reviewed-on: https://go-review.googlesource.com/46460 From-SVN: r249578
Ian Lance Taylor committed -
The CgocallbackDone function calls dropm after it calls entersyscall, which means that dropm must not have any write barriers. Mark it accordingly. Reviewed-on: https://go-review.googlesource.com/46464 From-SVN: r249577
Ian Lance Taylor committed -
Use go:linkname to export the getm function. This makes it visible to runtime/testdata/testprogcgo/dropm_stub.go, which uses it as part of the TestEnsureDropM test in runtime/crash_cgo_test.go. That test is not run today, but it will be soon. Reviewed-on: https://go-review.googlesource.com/46462 From-SVN: r249576
Ian Lance Taylor committed -
Patch from Rainer Orth. Reviewed-on: https://go-review.googlesource.com/46459 From-SVN: r249575
Ian Lance Taylor committed -
In libgo system goroutines register themselves after they start. That means that there is a small race between the goroutine being seen by the scheduler and the scheduler knowing that the goroutine is a system goroutine. That in turn means that runtime.NumGoroutines can overestimate the number of goroutines at times. This patch fixes the overestimate by counting the number of system goroutines waiting to start, and pausing NumGoroutines until those goroutines have all registered. This is kind of a lot of mechanism for this not very important problem, but I couldn't think of a better approach. The test for this is TestNumGoroutine in runtime/proc_test.go. The test is not currently run, but it will be soon. Reviewed-on: https://go-review.googlesource.com/46457 From-SVN: r249565
Ian Lance Taylor committed -
With the gc toolchain apparently var s *string _ = *s is enough to panic with a nil pointer dereference. The gccgo compiler will simply discard the dereference, which I think is a reasonable and acceptable optimization. Change the tests to use an exported variable instead. The tests are not currently run, but they will be with a later patch to gotools. Reviewed-on: https://go-review.googlesource.com/46450 From-SVN: r249562
Ian Lance Taylor committed -
Because of how gccgo implements cgo calls, the code in dropm may not have any write barriers. As a step toward implementing that, change the gcstack, gcnextsegment, and gcnextsp fields of the g struct to uintptr, so that assignments to them do not require write barriers. The gcinitialsp field remains unsafe.Pointer, as on 32-bit systems that do not support split stack it points to a heap allocated space used for the goroutine stack. The test for this is runtime tests like TestCgoCallbackGC, which are not run today but will be run with a future gotools patch. Reviewed-on: https://go-review.googlesource.com/46396 From-SVN: r249561
Ian Lance Taylor committed -
Calling a deferred function currently requires changing from a uintptr to the function code to a Go function value. That is done by setting the value of a func local variable using unsafe.Pointer. The local variable will always be on the stack. Adjust the code that sets the local variable to avoid generating a write barrier. A write barrier is never needed here. Also, for deferreturn, we must avoid write barriers entirely when called from a cgo function; that requires more than just this, but this is a start. The test for this is runtime tests that use the go tool; these are not currently run, but they will be in the future. Reviewed-on: https://go-review.googlesource.com/46455 From-SVN: r249559
Ian Lance Taylor committed -
The gc version of the _defer struct has a _panic field that has a completely different meaning. We are going to want that bring that new meaning into the gofrontend to improve panic reports with nested panic calls. Simplify that by first renaming the existing _panic field. Reviewed-on: https://go-review.googlesource.com/46454 From-SVN: r249558
Ian Lance Taylor committed -
- don't run tests that depend on SetCgoTraceback - don't expect a '(' after the function name in a traceback - change the expected name of nested functions in a traceback These tests are not currently run, but they will be soon. Reviewed-on: https://go-review.googlesource.com/46453 From-SVN: r249557
Ian Lance Taylor committed -
The gofrontend doesn't support the runtime.SetCgoTraceback function, which is specifically for handling mixed Go and C tracebacks. Use a build tag to avoid compiling the runtime/testdata/testprogcgo files that refer to SetCgoTraceback. These files are not currently compiled anyhow, but they will be with a future gotools patch. Reviewed-on: https://go-review.googlesource.com/46452 From-SVN: r249556
Ian Lance Taylor committed -
Building this test with gccgo requires an explicit -pthread option to be passed to the C compiler, so that it links against -lpthread. This test is not built today, but it will be soon with a future patch. Reviewed-on: https://go-review.googlesource.com/46451 From-SVN: r249555
Ian Lance Taylor committed -
The gc toolchain does the same thing, in gentraceback in runtime/traceback.go. The test for this is TestPanicTraceback in runtime/crash_test.go. We don't yet run that test, but we will in a future change. Reviewed-on: https://go-review.googlesource.com/46397 From-SVN: r249495
Ian Lance Taylor committed -
The test for this is TestGoNil in the runtime package, which we don't run yet but will run with a subsequent gotools patch. Updates golang/go#8045 Reviewed-on: https://go-review.googlesource.com/46392 From-SVN: r249494
Ian Lance Taylor committed
-
- 21 Jun, 2017 8 commits
-
-
Patch by Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/46391 From-SVN: r249487
Ian Lance Taylor committed -
libgo: remove old MIPS architecture names This removes the old names for the 3 main MIPS ABIs: mipso32, mipsn32 and mipsn64. It also removes the mipso64 ABI which has no equivalent architecture name in go. This ABI has been dead for sometime and I doubt anyone will miss it. Change-Id: I087b243784edf6705fdaf9c32e3233da5e387283 From-SVN: r249485
Ian Lance Taylor committed -
This removes the old names for the 3 main MIPS ABIs: mipso32, mipsn32 and mipsn64. It also removes the mipso64 ABI which has no equivalent architecture name in go. This ABI has been dead for sometime and I doubt anyone will miss it. Reviewed-on: https://go-review.googlesource.com/46154 From-SVN: r249477
Ian Lance Taylor committed -
This means that the gc tools and gofrontend agree on the architecture names for the 3 MIPS ABIs which should allow a gofrontend compiler to build go. Reviewed-on: https://go-review.googlesource.com/46153 From-SVN: r249476
Ian Lance Taylor committed -
Reviewed-on: https://go-review.googlesource.com/46152 From-SVN: r249475
Ian Lance Taylor committed -
Rename getrandom_linux_mipsn32.go to use the new architecture name for the n32 ABI and enable building it on mips64p32 and mips64p32le. Reviewed-on: https://go-review.googlesource.com/46151 From-SVN: r249474
Ian Lance Taylor committed -
On MIPS, the correct structure for PtraceRegs is 'struct pt_regs' which is declared in linux/ptrace.h. Previously no PtraceRegs structure was created on MIPS because 'struct user_regs_struct' doesn't exist there. Fallback to using pt_regs when the PtraceRegs structure is generated in mksysinfo.sh, then adjust syscall_linux_mipsx.go to read the program counter from the correct field. In addition, implement PtraceGetRegs and PtraceSetRegs on all 3 ABI variants. syscall_linux_mips64x.go can now be removed since the ptrace code on all 3 ABIs is identical. Reviewed-on: https://go-review.googlesource.com/46150 From-SVN: r249473
Ian Lance Taylor committed -
On MIPS, the correct structure for PtraceRegs is 'struct pt_regs' which is declared in linux/ptrace.h. Previously no PtraceRegs structure was created on MIPS because 'struct user_regs_struct' doesn't exist there. Fallback to using pt_regs when the PtraceRegs structure is generated in mksysinfo.sh, then adjust syscall_linux_mipsx.go to read the program counter from the correct field. In addition, implement PtraceGetRegs and PtraceSetRegs on all 3 ABI variants. syscall_linux_mips64x.go can now be removed since the ptrace code on all 3 ABIs is identical. Reviewed-on: https://go-review.googlesource.com/46150 From-SVN: r249472
Ian Lance Taylor committed
-
- 14 Jun, 2017 5 commits
-
-
The go tool will pass -I objdir as one of the flags, where objdir is the temporary build directory. Remove that from _cgo_flags: we don't need it, and it will be different each time. Sort the flags to avoid the unpredictable map iteration order. This matters for gccgo because for a package that uses cgo, the go tool when building for gccgo will store the _cgo_flags file in the archive. That means that we want to generate identical _cgo_flags for every run. The test for this is the cmd/go testsuite, to follow in a future CL. Reviewed-on: https://go-review.googlesource.com/45692 From-SVN: r249199
Ian Lance Taylor committed -
Pass the -fdebug-prefix-map and -gno-record-gcc-switches compiler options to gccgo to generate consistent results. Fix the vendoring code to look for /vendor/, not just /vendor, to avoid being confused by something like vendor/vendor.org. Tested by the cmd/go tests in a followup CL. Reviewed-on: https://go-review.googlesource.com/45695 From-SVN: r249198
Ian Lance Taylor committed -
These tests fail for various reasons, most commonly because gccgo doesn't really have GOROOT, so things like `go build errors` fail. Reviewed-on: https://go-review.googlesource.com/45696 From-SVN: r249197
Ian Lance Taylor committed -
Add the environment variable GCCGOTOOLDIR to permit overriding the default directory where tools like cgo are found when building with gccgo. This will be used by the cmd/go tests in a future CL. Reviewed-on: https://go-review.googlesource.com/45694 From-SVN: r249196
Ian Lance Taylor committed -
If GO_TESTING_GOTOOLS is set in the environment, permit tests using gccgo to run the go tool. Like GO_BUILDER_NAME, this should not be set normally. But it is needed when testing the go tool itself, and will be set by the gotools Makefile in a future CL. Reviewed-on: https://go-review.googlesource.com/45693 From-SVN: r249195
Ian Lance Taylor committed
-
- 13 Jun, 2017 2 commits
-
-
If there is no function name, the traceback is generally uninformative. In earlier versions we did not show such frames. Restore that behavior. These frames can be seen with GOTRACEBACK=system. Reviewed-on: https://go-review.googlesource.com/45431 From-SVN: r249156
Ian Lance Taylor committed -
Otherwise it may be set when the g struct is reused via gfput/gfget. Test is golang.org/x/net/http2 with GOMAXPROCS=12. Reviewed-on: https://go-review.googlesource.com/45430 From-SVN: r249143
Ian Lance Taylor committed
-
- 12 Jun, 2017 1 commit
-
-
Also always access the atomicstatus field atomically. The effect of not checking the _Gscan bit is that if the GC decides to scan the stack just as the goroutine is leaving the system call, the goroutine might fail to call exitsyscall. Then then typically causes a runtime assertion failure later on. If we do call exitsyscall as we should, it will stall (in casgstatus) until the _Gscan bit is cleared. No separate test. I've observed causing sporadic failures running the misc/cgo tests, but we don't currently have a way to run those routinely for gccgo. I should fix that. Reviewed-on: https://go-review.googlesource.com/45392 From-SVN: r249138
Ian Lance Taylor committed
-